submissions: deny mapfix targeting nonexistent map
This commit is contained in:
parent
d4e8edbb6e
commit
a72be13843
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.itzana.me/strafesnet/go-grpc/maps"
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/api"
|
"git.itzana.me/strafesnet/maps-service/pkg/api"
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
||||||
@ -63,6 +64,18 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger
|
|||||||
return nil, ErrCreationPhaseMapfixesLimit
|
return nil, ErrCreationPhaseMapfixesLimit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if TargetAssetID actually exists
|
||||||
|
{
|
||||||
|
_, err := svc.Client.Get(ctx, &maps.IdMessage{
|
||||||
|
ID: request.TargetAssetID,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
// TODO: match specific does not exist grpc error
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
operation, err := svc.DB.Operations().Create(ctx, model.Operation{
|
operation, err := svc.DB.Operations().Create(ctx, model.Operation{
|
||||||
Owner: int64(userId),
|
Owner: int64(userId),
|
||||||
StatusID: model.OperationStatusCreated,
|
StatusID: model.OperationStatusCreated,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user