Phone country code unique (#9035)

fix #8775
This commit is contained in:
Guillim
2024-12-19 16:42:18 +01:00
committed by GitHub
parent 3f58a41d2f
commit 360c34fd18
47 changed files with 878 additions and 132 deletions

View File

@ -18,6 +18,12 @@ export const phonesCompositeType: CompositeType = {
hidden: false,
isRequired: false,
},
{
name: 'primaryPhoneCallingCode',
type: FieldMetadataType.TEXT,
hidden: false,
isRequired: false,
},
{
name: 'additionalPhones',
type: FieldMetadataType.RAW_JSON,
@ -30,5 +36,6 @@ export const phonesCompositeType: CompositeType = {
export type PhonesMetadata = {
primaryPhoneNumber: string;
primaryPhoneCountryCode: string;
primaryPhoneCallingCode: string;
additionalPhones: object | null;
};

View File

@ -193,6 +193,10 @@ export class FieldMetadataDefaultValuePhones {
@IsQuotedString()
primaryPhoneCountryCode: string | null;
@ValidateIf((_object, value) => value !== null)
@IsQuotedString()
primaryPhoneCallingCode: string | null;
@ValidateIf((_object, value) => value !== null)
@IsObject()
additionalPhones: object | null;

View File

@ -44,6 +44,7 @@ export function generateDefaultValue(
return {
primaryPhoneNumber: "''",
primaryPhoneCountryCode: "''",
primaryPhoneCallingCode: "''",
additionalPhones: null,
};
default: