submissions: mark operation as completed
This commit is contained in:
parent
fe2c20bd72
commit
56681f8862
pkg/service_internal
@ -3,6 +3,7 @@ package service_internal
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
||||
@ -125,6 +126,16 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *internal.MapfixCr
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// mark the operation as completed and provide the path
|
||||
pmap := datastore.Optional()
|
||||
pmap.Add("status_id", model.OperationStatusCompleted)
|
||||
pmap.Add("path", fmt.Sprintf("/mapfixes/%d", mapfix.ID))
|
||||
err = svc.DB.Operations().Update(ctx, request.OperationID, pmap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &internal.MapfixID{
|
||||
MapfixID: mapfix.ID,
|
||||
}, nil
|
||||
|
@ -3,6 +3,7 @@ package service_internal
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
||||
@ -124,6 +125,16 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *internal.Subm
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// mark the operation as completed and provide the path
|
||||
pmap := datastore.Optional()
|
||||
pmap.Add("status_id", model.OperationStatusCompleted)
|
||||
pmap.Add("path", fmt.Sprintf("/submissions/%d", submission.ID))
|
||||
err = svc.DB.Operations().Update(ctx, request.OperationID, pmap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &internal.SubmissionID{
|
||||
SubmissionID: submission.ID,
|
||||
}, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user