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

Fix labelIdentifierFieldMetadata creation for custom objects #8729

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Nov 25, 2024

No description provided.

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 validation and error handling for label identifier fields in custom objects, ensuring proper creation and association of label identifiers with object metadata.

  • Added INVALID_LABEL_IDENTIFIER exception code in /packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.exception.ts
  • Added validation check in createOne() to ensure label identifier field exists using CUSTOM_OBJECT_STANDARD_FIELD_IDS.name
  • Added automatic update of labelIdentifierFieldMetadataId after object creation in /packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.service.ts
  • Implemented error handling to throw exception when label identifier field creation fails

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@lucasbordeau lucasbordeau left a comment

Choose a reason for hiding this comment

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

LGTM

if (!labelIdentifierFieldMetadata) {
throw new ObjectMetadataException(
'Label identifier field metadata not created properly',
ObjectMetadataExceptionCode.INVALID_LABEL_IDENTIFIER,
Copy link
Member

Choose a reason for hiding this comment

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

MISSING_LABEL_IDENTIFIER

Copy link
Member

@charlesBochet charlesBochet Nov 26, 2024

Choose a reason for hiding this comment

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

MISSING_CUSTOM_OBJECT_DEFAULT_LABEL_IDENTIFIER_FIELD

Weiko added a commit that referenced this pull request Nov 26, 2024
## Context
Following #8729

This command backfills missing labelIdentifier for custom objects
@Weiko Weiko merged commit 182f9b1 into main Nov 26, 2024
19 checks passed
@Weiko Weiko deleted the c--fix-label-identifier-creation-for-custom-objects branch November 26, 2024 10:19
Weiko added a commit that referenced this pull request Nov 26, 2024
## Context
Following #8729

This command backfills missing labelIdentifier for custom objects
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.

3 participants