Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete record action #8908

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Add delete record action #8908

merged 2 commits into from
Dec 6, 2024

Conversation

thomtrp
Copy link
Contributor

@thomtrp thomtrp commented Dec 5, 2024

Capture d’écran 2024-12-05 à 18 04 19
  • Adding new action
  • Adding tests
  • Moving into action folder

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds a new Delete Record action to the workflow system, enabling users to delete records through workflow automation.

  • Added new RECORD_CRUD.DELETE action type in /packages/twenty-front/src/modules/workflow/constants/Actions.ts with corresponding UI components
  • Implemented WorkflowEditActionFormRecordDelete component in /workflow-actions/components/ for selecting objects and records to delete
  • Added type guard isWorkflowRecordDeleteAction with comprehensive test coverage in /workflow-actions/utils/
  • Added server-side support in workflow-version-step.workspace-service.ts for handling delete record actions
  • Critical bug found in isWorkflowRecordUpdateAction.test.ts where test expectations are reversed for CREATE/UPDATE actions

13 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@martmull martmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM some comment

@@ -169,6 +169,27 @@ export class WorkflowVersionStepWorkspaceService {
},
};
}
case `${WorkflowActionType.RECORD_CRUD}.${WorkflowRecordCRUDType.DELETE}`: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we need to fix that, in a dedicated PR probably

Comment on lines +124 to +131
if (actionOptions.readonly === true) {
return;
}

actionOptions.onActionUpdate({
...action,
name: newName,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we don't just add this readonly check directly in the onActionUpdate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually when readonly is set, onActionUpdate has to be undefined (see props definition above).
We need the readonly props to disable buttons and fields in some actions. So we still need to pass the props. Adding the readonly in onActionUpdate would simply remove the check above.
But I actually like the component to have its logic and not trust blindly the parent so I am not sure I would even remove that check

@thomtrp thomtrp merged commit 5c56534 into main Dec 6, 2024
19 checks passed
@thomtrp thomtrp deleted the tt-add-delete-action branch December 6, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants