submissions: UpdateSubmissionModel internal endpoint
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
not quite duplicate code, hooray
This commit is contained in:
parent
7a7e158ec3
commit
67651633d8
@ -127,7 +127,7 @@ func (svc *Service) SetSubmissionCompleted(ctx context.Context, params api.SetSu
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// PatchSubmissionModel implements patchSubmissionModel operation.
|
// UpdateSubmissionModel implements patchSubmissionModel operation.
|
||||||
//
|
//
|
||||||
// Update model following role restrictions.
|
// Update model following role restrictions.
|
||||||
//
|
//
|
||||||
|
@ -8,6 +8,21 @@ import (
|
|||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
"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.
|
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
|
||||||
//
|
//
|
||||||
// Role Validator changes status from Validating -> Validated.
|
// Role Validator changes status from Validating -> Validated.
|
||||||
|
Loading…
Reference in New Issue
Block a user