submissions: UpdateSubmissionModel internal endpoint
All checks were successful
continuous-integration/drone/push Build is passing

not quite duplicate code, hooray
This commit is contained in:
Quaternions 2024-12-17 18:26:07 -08:00
parent 7a7e158ec3
commit 67651633d8
2 changed files with 16 additions and 1 deletions

View File

@ -127,7 +127,7 @@ func (svc *Service) SetSubmissionCompleted(ctx context.Context, params api.SetSu
return err
}
// PatchSubmissionModel implements patchSubmissionModel operation.
// UpdateSubmissionModel implements patchSubmissionModel operation.
//
// Update model following role restrictions.
//

View File

@ -8,6 +8,21 @@ import (
"git.itzana.me/strafesnet/maps-service/pkg/model"
)
// UpdateSubmissionModel implements patchSubmissionModel operation.
//
// Update model following role restrictions.
//
// POST /submissions/{SubmissionID}/model
func (svc *Service) UpdateSubmissionModel(ctx context.Context, params internal.UpdateSubmissionModelParams) error {
// check if Status is ChangesRequested|Submitted|UnderConstruction
pmap := datastore.Optional()
pmap.AddNotNil("asset_id", params.ModelID)
pmap.AddNotNil("asset_version", params.VersionID)
//always reset completed when model changes
pmap.Add("completed", false)
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusValidating}, pmap)
}
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
//
// Role Validator changes status from Validating -> Validated.