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

Cannot delete label identifier associated field #6340

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Jul 19, 2024

Context

An object should always have a labelIdentifier (would be its primary key at least). If the associated field is deleted by a user, it will break the app. Ideally we should handle that on the DB level but we don't have a FK for this column yet.
In the meantime I'm adding the validation check in the backend, note that this is already handle on the FE side since the "archive/delete" buttons don't appear for such fields so you need to reassign it to another field first which is the desired behaviour.

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

  • Added validation in packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts to prevent deletion of label identifier-associated fields
  • Throws FieldMetadataException if deletion is attempted without reassigning the label identifier field

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@Weiko Weiko merged commit a374922 into main Jul 19, 2024
4 of 5 checks passed
@Weiko Weiko deleted the c--cannot-delete-label-identifier-associated-field branch July 19, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants