This commit is contained in:
Quaternions 2024-11-26 14:10:30 -08:00
parent 6a3d9da2e9
commit 7485729fd0
2 changed files with 4 additions and 6 deletions

View File

@ -5,10 +5,8 @@ import (
"fmt"
"git.itzana.me/strafesnet/maps-service/internal/datastore"
"git.itzana.me/strafesnet/maps-service/internal/model"
"git.itzana.me/strafesnet/go-grpc/maps"
"git.itzana.me/strafesnet/maps-service/api"
"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"time"
)
@ -17,8 +15,8 @@ type Maps struct {
Store datastore.Datastore
}
func (m Maps) Get(ctx context.Context, message *maps.IdMessage) (*maps.MapResponse, error) {
item, err := m.Store.Maps().Get(ctx, message.GetID())
func (m Maps) Get(ctx context.Context, params *api.GetSubmissionParams) (*api.Submission, error) {
item, err := m.Store.Maps().Get(ctx, params.SubmissionID)
if err != nil {
if err == datastore.ErrNotExist {
return nil, status.Error(codes.NotFound, "map does not exit")

View File

@ -17,7 +17,7 @@ type apiServer struct {
// GetUserRank implements api.Handler.
func (m *apiServer) GetSubmission(ctx context.Context, params api.GetSubmissionParams) (*api.Submission, error) {
return m.submissions.Get(params.SubmissionID)
return m.submissions.Get(ctx,params)
}
// NewError implements api.Handler.