submissions: mark operation as completed
This commit is contained in:
parent
e36244b9b8
commit
5e633721c8
pkg/service_internal
@ -3,6 +3,7 @@ package service_internal
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
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{
|
return &internal.MapfixID{
|
||||||
MapfixID: mapfix.ID,
|
MapfixID: mapfix.ID,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -3,6 +3,7 @@ package service_internal
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
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{
|
return &internal.SubmissionID{
|
||||||
SubmissionID: submission.ID,
|
SubmissionID: submission.ID,
|
||||||
}, nil
|
}, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user