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"
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
}

View File

@ -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)),
})
}