diff --git a/pkg/model/submission.go b/pkg/model/submission.go index aa72d25..f86eba4 100644 --- a/pkg/model/submission.go +++ b/pkg/model/submission.go @@ -2,6 +2,22 @@ package model import "time" +type Status int32 + +const( + Published Status=8 + Rejected Status=7 + + Publishing Status=6 + Validated Status=5 + Validating Status=4 + Accepted Status=3 + + ChangesRequested Status=2 + Submitted Status=1 + UnderConstruction Status=0 +) + type Submission struct { ID int64 DisplayName string @@ -13,5 +29,5 @@ type Submission struct { AssetVersion int64 Completed bool TargetAssetID int64 // where to upload map fix. if the TargetAssetID is 0, it's a new map. - StatusID int32 + StatusID Status } diff --git a/pkg/service/submissions.go b/pkg/service/submissions.go index 07c826a..5f45cbc 100644 --- a/pkg/service/submissions.go +++ b/pkg/service/submissions.go @@ -22,7 +22,7 @@ func (svc *Service) CreateSubmission(ctx context.Context, request api.OptSubmiss AssetVersion: request.Value.AssetVersion.Value, Completed: false, TargetAssetID: request.Value.TargetAssetID.Value, - StatusID: 0, + StatusID: model.UnderConstruction, }) if err != nil{ return nil, err @@ -53,7 +53,7 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP AssetVersion: api.NewOptInt64(submission.AssetVersion), Completed: api.NewOptBool(submission.Completed), TargetAssetID: api.NewOptInt64(submission.TargetAssetID), - StatusID: api.NewOptInt32(submission.StatusID), + StatusID: api.NewOptInt32(int32(submission.StatusID)), }, nil } @@ -92,7 +92,7 @@ func (svc *Service) ListSubmissions(ctx context.Context, request api.ListSubmiss AssetVersion: api.NewOptInt64(items[i].AssetVersion), Completed: api.NewOptBool(items[i].Completed), TargetAssetID: api.NewOptInt64(items[i].TargetAssetID), - StatusID: api.NewOptInt32(items[i].StatusID), + StatusID: api.NewOptInt32(int32(items[i].StatusID)), }) }