diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index e8c2c0a2b..94909090e 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -559,10 +559,10 @@ func (r *mutationResolver) CreateAction(ctx context.Context, action model.Action switch action.Type { case actionservices.ActionTypeAddClusterInfo: return actionservices.CreateAddClusterInfo(ctx, action) - case actionservices.ActionTypeDeleteAttribute: return actionservices.CreateDeleteAttribute(ctx, action) - + case actionservices.ActionTypePiiMasking: + return actionservices.CreatePiiMasking(ctx, action) default: return nil, fmt.Errorf("unsupported action type: %s", action.Type) } @@ -574,10 +574,10 @@ func (r *mutationResolver) UpdateAction(ctx context.Context, id string, action m switch action.Type { case actionservices.ActionTypeAddClusterInfo: return actionservices.UpdateAddClusterInfo(ctx, id, action) - case actionservices.ActionTypeDeleteAttribute: return actionservices.UpdateDeleteAttribute(ctx, id, action) - + case actionservices.ActionTypePiiMasking: + return actionservices.UpdatePiiMasking(ctx, id, action) default: return nil, fmt.Errorf("unsupported action type: %s", action.Type) } @@ -598,7 +598,11 @@ func (r *mutationResolver) DeleteAction(ctx context.Context, id string, actionTy if err != nil { return false, fmt.Errorf("failed to delete DeleteAttribute: %v", err) } - + case actionservices.ActionTypePiiMasking: + err := actionservices.DeletePiiMasking(ctx, id) + if err != nil { + return false, fmt.Errorf("failed to delete PiiMasking: %v", err) + } default: return false, fmt.Errorf("unsupported action type: %s", actionType) } diff --git a/frontend/services/actions/piimasking.go b/frontend/services/actions/piimasking.go index d39c4cbb2..6056100ae 100644 --- a/frontend/services/actions/piimasking.go +++ b/frontend/services/actions/piimasking.go @@ -51,6 +51,11 @@ func CreatePiiMasking(ctx context.Context, action model.ActionInput) (model.Acti return nil, fmt.Errorf("failed to create PiiMasking: %v", err) } + piiCategories := make([]string, len(details.PiiCategories)) + for i, category := range details.PiiCategories { + piiCategories[i] = string(category) + } + response := &model.PiiMaskingAction{ ID: generatedAction.Name, Type: ActionTypePiiMasking, @@ -58,7 +63,7 @@ func CreatePiiMasking(ctx context.Context, action model.ActionInput) (model.Acti Notes: action.Notes, Disable: action.Disable, Signals: action.Signals, - Details: details.PiiCategories, + Details: piiCategories, } return response, nil @@ -95,6 +100,11 @@ func UpdatePiiMasking(ctx context.Context, id string, action model.ActionInput) return nil, fmt.Errorf("failed to update PiiMasking: %v", err) } + piiCategories := make([]string, len(details.PiiCategories)) + for i, category := range details.PiiCategories { + piiCategories[i] = string(category) + } + response := &model.PiiMaskingAction{ ID: updatedAction.Name, Type: ActionTypePiiMasking, @@ -102,7 +112,7 @@ func UpdatePiiMasking(ctx context.Context, id string, action model.ActionInput) Notes: action.Notes, Disable: action.Disable, Signals: action.Signals, - Details: details.PiiCategories, + Details: piiCategories, } return response, nil