submission Status enum

This commit is contained in:
Quaternions 2024-11-27 17:27:22 -08:00
parent 1984dd00bc
commit 23ffa45db2
2 changed files with 20 additions and 4 deletions

View File

@ -2,6 +2,22 @@ package model
import "time" 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 { type Submission struct {
ID int64 ID int64
DisplayName string DisplayName string
@ -13,5 +29,5 @@ type Submission struct {
AssetVersion int64 AssetVersion int64
Completed bool Completed bool
TargetAssetID int64 // where to upload map fix. if the TargetAssetID is 0, it's a new map. TargetAssetID int64 // where to upload map fix. if the TargetAssetID is 0, it's a new map.
StatusID int32 StatusID Status
} }

View File

@ -22,7 +22,7 @@ func (svc *Service) CreateSubmission(ctx context.Context, request api.OptSubmiss
AssetVersion: request.Value.AssetVersion.Value, AssetVersion: request.Value.AssetVersion.Value,
Completed: false, Completed: false,
TargetAssetID: request.Value.TargetAssetID.Value, TargetAssetID: request.Value.TargetAssetID.Value,
StatusID: 0, StatusID: model.UnderConstruction,
}) })
if err != nil{ if err != nil{
return nil, err return nil, err
@ -53,7 +53,7 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP
AssetVersion: api.NewOptInt64(submission.AssetVersion), AssetVersion: api.NewOptInt64(submission.AssetVersion),
Completed: api.NewOptBool(submission.Completed), Completed: api.NewOptBool(submission.Completed),
TargetAssetID: api.NewOptInt64(submission.TargetAssetID), TargetAssetID: api.NewOptInt64(submission.TargetAssetID),
StatusID: api.NewOptInt32(submission.StatusID), StatusID: api.NewOptInt32(int32(submission.StatusID)),
}, nil }, nil
} }
@ -92,7 +92,7 @@ func (svc *Service) ListSubmissions(ctx context.Context, request api.ListSubmiss
AssetVersion: api.NewOptInt64(items[i].AssetVersion), AssetVersion: api.NewOptInt64(items[i].AssetVersion),
Completed: api.NewOptBool(items[i].Completed), Completed: api.NewOptBool(items[i].Completed),
TargetAssetID: api.NewOptInt64(items[i].TargetAssetID), TargetAssetID: api.NewOptInt64(items[i].TargetAssetID),
StatusID: api.NewOptInt32(items[i].StatusID), StatusID: api.NewOptInt32(int32(items[i].StatusID)),
}) })
} }