Fix phone unique constraints (#20261)
## Summary Closes #20195 Fix phone field unique constraints so phone numbers are considered unique by both `primaryPhoneNumber` and `primaryPhoneCallingCode`. - Include `primaryPhoneCallingCode` in the shared phone composite unique constraint metadata - Align the frontend settings composite field config with the backend metadata - Return all included unique composite subfields when building create-many conflict fields - Match composite unique conflict fields as a group during create-many upserts ## Root Cause Phone composite metadata only marked `primaryPhoneNumber` as part of the unique constraint. That made different international phone numbers with the same national number conflict, for example `+1 123456789` and `+32 123456789`. ## Test Plan - `yarn workspace twenty-shared build` - `jest --runTestsByPath <index action handler and create-many utility specs>` - `prettier --check <touched files>` - `oxlint --type-aware <touched files>` - `nx run twenty-shared:typecheck` - `nx run twenty-server:typecheck` - `nx run twenty-front:typecheck` --------- Co-authored-by: mkdev11 <MkDev11@users.noreply.github.com> Co-authored-by: Etienne <45695613+etiennejouan@users.noreply.github.com> Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
+2
@@ -19,6 +19,7 @@ export type EntitySchemaFieldMetadata<
|
||||
| 'type'
|
||||
| 'settings'
|
||||
| 'isNullable'
|
||||
| 'isUnique'
|
||||
| 'defaultValue'
|
||||
| 'options'
|
||||
| 'objectMetadataId'
|
||||
@@ -73,6 +74,7 @@ export const buildEntitySchemaMetadataMaps = (
|
||||
type: field.type,
|
||||
settings: field.settings,
|
||||
isNullable: field.isNullable,
|
||||
isUnique: field.isUnique,
|
||||
defaultValue: field.defaultValue,
|
||||
options: field.options,
|
||||
objectMetadataId: field.objectMetadataId,
|
||||
|
||||
Reference in New Issue
Block a user