diff --git a/pkg/service/submissions.go b/pkg/service/submissions.go index 32e2a0e..60add5f 100644 --- a/pkg/service/submissions.go +++ b/pkg/service/submissions.go @@ -302,7 +302,14 @@ func (svc *Service) ActionSubmissionTriggerPublish(ctx context.Context, params a // transaction smap := datastore.Optional() smap.Add("status_id",model.StatusPublishing) - return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusValidated}, smap) + err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusValidated}, smap) + if err != nil{ + return err + } + + svc.Nats.Publish("publish", []byte(params.SubmissionID)) + + return nil } // ActionSubmissionTriggerValidate invokes actionSubmissionTriggerValidate operation. // @@ -323,7 +330,14 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params // transaction smap := datastore.Optional() smap.Add("status_id",model.StatusValidating) - return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusSubmitted,model.StatusAccepted}, smap) + err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusSubmitted,model.StatusAccepted}, smap) + if err != nil{ + return err + } + + svc.Nats.Publish("validate", []byte(params.SubmissionID)) + + return nil } // ActionSubmissionValidate invokes actionSubmissionValidate operation. //