something like this

This commit is contained in:
Quaternions 2024-11-29 15:52:44 -08:00
parent 371271d084
commit eb9eeb518f

View File

@ -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.
//