3
0

Fixed deleted apigw status on save

Fixed bug that was overwriting deletedAt status in effect un-deleting
the route.
This commit is contained in:
Peter Grlica
2022-11-14 15:23:08 +01:00
parent aaafcc6cf6
commit 16257e9d4b

View File

@@ -2,6 +2,7 @@ package service
import (
"context"
"github.com/cortezaproject/corteza-server/pkg/apigw"
"github.com/cortezaproject/corteza-server/pkg/errors"
@@ -119,16 +120,13 @@ func (svc *apigwRoute) Update(ctx context.Context, upd *types.ApigwRoute) (q *ty
// return ApigwRouteErrExistsEndpoint(qProps)
// }
upd.UpdatedAt = now()
upd.CreatedAt = qq.CreatedAt
upd.UpdatedBy = a.GetIdentityFromContext(ctx).Identity()
qq.UpdatedAt = now()
qq.UpdatedBy = a.GetIdentityFromContext(ctx).Identity()
if err = store.UpdateApigwRoute(ctx, svc.store, upd); err != nil {
if err = store.UpdateApigwRoute(ctx, svc.store, qq); err != nil {
return
}
q = upd
ags := apigw.Service()
// If method or endpoint doesn't match then attach 404 handler
@@ -146,7 +144,7 @@ func (svc *apigwRoute) Update(ctx context.Context, upd *types.ApigwRoute) (q *ty
return nil
}()
return q, svc.recordAction(ctx, qProps, ApigwRouteActionUpdate, err)
return qq, svc.recordAction(ctx, qProps, ApigwRouteActionUpdate, err)
}
func (svc *apigwRoute) DeleteByID(ctx context.Context, ID uint64) (err error) {