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

Split record crud actions #8930

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Split record crud actions #8930

merged 2 commits into from
Dec 6, 2024

Conversation

thomtrp
Copy link
Contributor

@thomtrp thomtrp commented Dec 6, 2024

Having a global record crud action adds complex logic.
We decided to split those actions. I only kept a common folder / module in backend.

⚠️ this may break existing workflows if these were using previous actions!

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 splits the previously unified record CRUD actions into separate specialized actions for better code organization and reduced complexity.

  • Splits RECORD_CRUD into distinct CREATE_RECORD, UPDATE_RECORD, DELETE_RECORD, and FIND_RECORD action types in /packages/twenty-front/src/modules/workflow/types/Workflow.ts
  • Removes utility functions like isWorkflowRecordCreateAction in favor of direct action type checks
  • Adds dedicated workflow action classes like CreateRecordWorkflowAction and UpdateRecordWorkflowAction in /packages/twenty-server/src/modules/workflow/workflow-executor/workflow-actions/record-crud/
  • Updates WorkflowActionFactory and WorkflowBuilderWorkspaceService to handle the new separate action types
  • ⚠️ Breaking change that requires migration of existing workflows using the previous combined RECORD_CRUD action type

25 file(s) reviewed, 18 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +37 to +39
await repository.update(workflowActionInput.objectRecordId, {
...workflowActionInput.objectRecord,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: potential race condition between findOne and update - record could be deleted between these operations

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.

Love it 😍

@thomtrp thomtrp merged commit e1a0259 into main Dec 6, 2024
19 checks passed
@thomtrp thomtrp deleted the tt-separate-record-crud-actions branch December 6, 2024 15:59
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