From cf9cb7c6c3474c0d31e6ba7817d8026619354a2d Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 26 Nov 2024 15:55:56 -0800 Subject: [PATCH] implement GetSubmission --- pkg/service/submissions.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pkg/service/submissions.go b/pkg/service/submissions.go index 904dd1f..f67c879 100644 --- a/pkg/service/submissions.go +++ b/pkg/service/submissions.go @@ -16,7 +16,23 @@ func (svc *Service) CreateSubmission(ctx context.Context) (*api.Submission, erro // // GET /submissions/{SubmissionID} func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionParams) (*api.Submission, error) { - return nil, nil + submission, err := svc.DB.Submissions().Get(ctx, params.SubmissionID) + if err != nil{ + return nil, err + } + return &api.Submission{ + ID: api.NewOptInt64(submission.ID), + DisplayName: api.NewOptString(submission.DisplayName), + Creator: api.NewOptString(submission.Creator), + GameID: api.NewOptInt32(submission.GameID), + Date: api.NewOptInt64(submission.Date.Unix()), + Submitter: api.NewOptInt64(submission.Submitter), + AssetID: api.NewOptInt64(submission.AssetID), + AssetVersion: api.NewOptInt64(submission.AssetVersion), + Completed: api.NewOptBool(submission.Completed), + TargetAssetID: api.NewOptInt64(submission.TargetAssetID), + StatusID: api.NewOptInt32(submission.StatusID), + }, nil } // ListSubmissions implements listSubmissions operation.