Add fullName field metadata type (#2563)
* Add fullName field metadata type * update seeds
This commit is contained in:
@ -11,8 +11,7 @@ export enum SeedPersonFieldMetadataIds {
|
|||||||
CreatedAt = '20202020-bec0-4cf0-bf1c-8b2ed21f027a',
|
CreatedAt = '20202020-bec0-4cf0-bf1c-8b2ed21f027a',
|
||||||
UpdatedAt = '20202020-2bf4-42b8-8718-a3e852bfa6a6',
|
UpdatedAt = '20202020-2bf4-42b8-8718-a3e852bfa6a6',
|
||||||
|
|
||||||
FirstName = '20202020-9b56-4888-bfe3-f6f59aa999e3',
|
Name = '20202020-9b56-4888-bfe3-f6f59aa999e3',
|
||||||
LastName = '20202020-b784-458a-869d-6c53fa85483d',
|
|
||||||
|
|
||||||
Email = '20202020-8a96-4e4b-86fd-ea126530e0c1',
|
Email = '20202020-8a96-4e4b-86fd-ea126530e0c1',
|
||||||
LinkedinLink = '20202020-dcf6-445a-b543-37e55de43c25',
|
LinkedinLink = '20202020-dcf6-445a-b543-37e55de43c25',
|
||||||
@ -113,40 +112,23 @@ export const seedPersonFieldMetadata = async (
|
|||||||
},
|
},
|
||||||
// Main Identifier
|
// Main Identifier
|
||||||
{
|
{
|
||||||
id: SeedPersonFieldMetadataIds.FirstName,
|
id: SeedPersonFieldMetadataIds.Name,
|
||||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||||
isCustom: false,
|
isCustom: false,
|
||||||
workspaceId: SeedWorkspaceId,
|
workspaceId: SeedWorkspaceId,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.FULL_NAME,
|
||||||
name: 'firstName',
|
name: 'name',
|
||||||
label: 'First name',
|
label: 'Name',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'firstName',
|
firstName: 'nameFirstName',
|
||||||
|
lastName: 'nameLastName',
|
||||||
},
|
},
|
||||||
description: 'Contact’s first name',
|
description: 'Contact’s name',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
defaultValue: { value: '' },
|
defaultValue: { firstName: '', lastName: '' },
|
||||||
},
|
|
||||||
{
|
|
||||||
id: SeedPersonFieldMetadataIds.LastName,
|
|
||||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
|
||||||
isCustom: false,
|
|
||||||
workspaceId: SeedWorkspaceId,
|
|
||||||
isActive: true,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
name: 'lastName',
|
|
||||||
label: 'Last name',
|
|
||||||
targetColumnMap: {
|
|
||||||
value: 'lastName',
|
|
||||||
},
|
|
||||||
description: 'Contact’s last name',
|
|
||||||
icon: 'IconUser',
|
|
||||||
isNullable: false,
|
|
||||||
isSystem: false,
|
|
||||||
defaultValue: { value: '' },
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Scalar Fields
|
// Scalar Fields
|
||||||
|
|||||||
@ -11,8 +11,8 @@ export const seedPeople = async (
|
|||||||
.insert()
|
.insert()
|
||||||
.into(`${schemaName}.${tableName}`, [
|
.into(`${schemaName}.${tableName}`, [
|
||||||
'id',
|
'id',
|
||||||
'firstName',
|
'nameFirstName',
|
||||||
'lastName',
|
'nameLastName',
|
||||||
'phone',
|
'phone',
|
||||||
'city',
|
'city',
|
||||||
'companyId',
|
'companyId',
|
||||||
@ -22,8 +22,8 @@ export const seedPeople = async (
|
|||||||
.values([
|
.values([
|
||||||
{
|
{
|
||||||
id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
|
id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
|
||||||
firstName: 'Christoph',
|
nameFirstName: 'Christoph',
|
||||||
lastName: 'Callisto',
|
nameLastName: 'Callisto',
|
||||||
phone: '+33789012345',
|
phone: '+33789012345',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||||
@ -31,8 +31,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0',
|
id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0',
|
||||||
firstName: 'Sylvie',
|
nameFirstName: 'Sylvie',
|
||||||
lastName: 'Palmer',
|
nameLastName: 'Palmer',
|
||||||
phone: '+33780123456',
|
phone: '+33780123456',
|
||||||
city: 'Los Angeles',
|
city: 'Los Angeles',
|
||||||
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||||
@ -40,8 +40,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
|
id: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
|
||||||
firstName: 'Christopher',
|
nameFirstName: 'Christopher',
|
||||||
lastName: 'Gonzalez',
|
nameLastName: 'Gonzalez',
|
||||||
phone: '+33789012345',
|
phone: '+33789012345',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
||||||
@ -49,8 +49,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
|
id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
|
||||||
firstName: 'Ashley',
|
nameFirstName: 'Ashley',
|
||||||
lastName: 'Parker',
|
nameLastName: 'Parker',
|
||||||
phone: '+33780123456',
|
phone: '+33780123456',
|
||||||
city: 'Los Angeles',
|
city: 'Los Angeles',
|
||||||
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
||||||
@ -58,8 +58,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '9b324a88-6784-4449-afdf-dc62cb8702f2',
|
id: '9b324a88-6784-4449-afdf-dc62cb8702f2',
|
||||||
firstName: 'Nicholas',
|
nameFirstName: 'Nicholas',
|
||||||
lastName: 'Wright',
|
nameLastName: 'Wright',
|
||||||
phone: '+33781234567',
|
phone: '+33781234567',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||||
@ -67,8 +67,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '1d151852-490f-4466-8391-733cfd66a0c8',
|
id: '1d151852-490f-4466-8391-733cfd66a0c8',
|
||||||
firstName: 'Isabella',
|
nameFirstName: 'Isabella',
|
||||||
lastName: 'Scott',
|
nameLastName: 'Scott',
|
||||||
phone: '+33782345678',
|
phone: '+33782345678',
|
||||||
city: 'New York',
|
city: 'New York',
|
||||||
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||||
@ -76,8 +76,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '98406e26-80f1-4dff-b570-a74942528de3',
|
id: '98406e26-80f1-4dff-b570-a74942528de3',
|
||||||
firstName: 'Matthew',
|
nameFirstName: 'Matthew',
|
||||||
lastName: 'Green',
|
nameLastName: 'Green',
|
||||||
phone: '+33783456789',
|
phone: '+33783456789',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||||
@ -85,8 +85,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35',
|
id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35',
|
||||||
firstName: 'Elizabeth',
|
nameFirstName: 'Elizabeth',
|
||||||
lastName: 'Baker',
|
nameLastName: 'Baker',
|
||||||
phone: '+33784567890',
|
phone: '+33784567890',
|
||||||
city: 'New York',
|
city: 'New York',
|
||||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||||
@ -94,8 +94,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
|
id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
|
||||||
firstName: 'Christopher',
|
nameFirstName: 'Christopher',
|
||||||
lastName: 'Nelson',
|
nameLastName: 'Nelson',
|
||||||
phone: '+33785678901',
|
phone: '+33785678901',
|
||||||
city: 'San Francisco',
|
city: 'San Francisco',
|
||||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||||
@ -103,8 +103,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '56955422-5d54-41b7-ba36-f0d20e1417ae',
|
id: '56955422-5d54-41b7-ba36-f0d20e1417ae',
|
||||||
firstName: 'Avery',
|
nameFirstName: 'Avery',
|
||||||
lastName: 'Carter',
|
nameLastName: 'Carter',
|
||||||
phone: '+33786789012',
|
phone: '+33786789012',
|
||||||
city: 'New York',
|
city: 'New York',
|
||||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||||
@ -112,8 +112,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '755035db-623d-41fe-92e7-dd45b7c568e1',
|
id: '755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||||
firstName: 'Ethan',
|
nameFirstName: 'Ethan',
|
||||||
lastName: 'Mitchell',
|
nameLastName: 'Mitchell',
|
||||||
phone: '+33787890123',
|
phone: '+33787890123',
|
||||||
city: 'Los Angeles',
|
city: 'Los Angeles',
|
||||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||||
@ -121,8 +121,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '240da2ec-2d40-4e49-8df4-9c6a049190ef',
|
id: '240da2ec-2d40-4e49-8df4-9c6a049190ef',
|
||||||
firstName: 'Madison',
|
nameFirstName: 'Madison',
|
||||||
lastName: 'Perez',
|
nameLastName: 'Perez',
|
||||||
phone: '+33788901234',
|
phone: '+33788901234',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||||
@ -130,8 +130,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '240da2ec-2d40-4e49-8df4-9c6a049190df',
|
id: '240da2ec-2d40-4e49-8df4-9c6a049190df',
|
||||||
firstName: 'Bertrand',
|
nameFirstName: 'Bertrand',
|
||||||
lastName: 'Voulzy',
|
nameLastName: 'Voulzy',
|
||||||
phone: '+33788901234',
|
phone: '+33788901234',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||||
@ -139,8 +139,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '240da2ec-2d40-4e49-8df4-9c6a049191de',
|
id: '240da2ec-2d40-4e49-8df4-9c6a049191de',
|
||||||
firstName: 'Louis',
|
nameFirstName: 'Louis',
|
||||||
lastName: 'Duss',
|
nameLastName: 'Duss',
|
||||||
phone: '+33788901234',
|
phone: '+33788901234',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
|
companyId: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
|
||||||
@ -148,8 +148,8 @@ export const seedPeople = async (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '240da2ec-2d40-4e49-8df4-9c6a049191df',
|
id: '240da2ec-2d40-4e49-8df4-9c6a049191df',
|
||||||
firstName: 'Lorie',
|
nameFirstName: 'Lorie',
|
||||||
lastName: 'Vladim',
|
nameLastName: 'Vladim',
|
||||||
phone: '+33788901235',
|
phone: '+33788901235',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
companyId: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
|
companyId: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
|
||||||
|
|||||||
@ -30,6 +30,7 @@ export enum FieldMetadataType {
|
|||||||
LINK = 'LINK',
|
LINK = 'LINK',
|
||||||
CURRENCY = 'CURRENCY',
|
CURRENCY = 'CURRENCY',
|
||||||
RELATION = 'RELATION',
|
RELATION = 'RELATION',
|
||||||
|
FULL_NAME = 'FULL_NAME',
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity('fieldMetadata')
|
@Entity('fieldMetadata')
|
||||||
|
|||||||
@ -33,11 +33,17 @@ interface FieldMetadataDefaultValueCurrency {
|
|||||||
currencyCode: string;
|
currencyCode: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface FieldMetadataDefaultValueFullName {
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
}
|
||||||
|
|
||||||
type AllFieldMetadataDefaultValueTypes =
|
type AllFieldMetadataDefaultValueTypes =
|
||||||
| FieldMetadataScalarDefaultValue
|
| FieldMetadataScalarDefaultValue
|
||||||
| FieldMetadataDynamicDefaultValue
|
| FieldMetadataDynamicDefaultValue
|
||||||
| FieldMetadataDefaultValueLink
|
| FieldMetadataDefaultValueLink
|
||||||
| FieldMetadataDefaultValueCurrency;
|
| FieldMetadataDefaultValueCurrency
|
||||||
|
| FieldMetadataDefaultValueFullName;
|
||||||
|
|
||||||
type FieldMetadataDefaultValueMapping = {
|
type FieldMetadataDefaultValueMapping = {
|
||||||
[FieldMetadataType.UUID]: FieldMetadataDefaultValueString;
|
[FieldMetadataType.UUID]: FieldMetadataDefaultValueString;
|
||||||
@ -51,6 +57,7 @@ type FieldMetadataDefaultValueMapping = {
|
|||||||
[FieldMetadataType.ENUM]: FieldMetadataDefaultValueString;
|
[FieldMetadataType.ENUM]: FieldMetadataDefaultValueString;
|
||||||
[FieldMetadataType.LINK]: FieldMetadataDefaultValueLink;
|
[FieldMetadataType.LINK]: FieldMetadataDefaultValueLink;
|
||||||
[FieldMetadataType.CURRENCY]: FieldMetadataDefaultValueCurrency;
|
[FieldMetadataType.CURRENCY]: FieldMetadataDefaultValueCurrency;
|
||||||
|
[FieldMetadataType.FULL_NAME]: FieldMetadataDefaultValueFullName;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DefaultValueByFieldMetadata<T extends FieldMetadataType | 'default'> = [
|
type DefaultValueByFieldMetadata<T extends FieldMetadataType | 'default'> = [
|
||||||
|
|||||||
@ -14,6 +14,11 @@ export interface FieldMetadataTargetColumnMapCurrency {
|
|||||||
currencyCode: string;
|
currencyCode: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FieldMetadataTargetColumnMapFullName {
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
}
|
||||||
|
|
||||||
type AllFieldMetadataTypes = {
|
type AllFieldMetadataTypes = {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
@ -21,6 +26,7 @@ type AllFieldMetadataTypes = {
|
|||||||
type FieldMetadataTypeMapping = {
|
type FieldMetadataTypeMapping = {
|
||||||
[FieldMetadataType.LINK]: FieldMetadataTargetColumnMapLink;
|
[FieldMetadataType.LINK]: FieldMetadataTargetColumnMapLink;
|
||||||
[FieldMetadataType.CURRENCY]: FieldMetadataTargetColumnMapCurrency;
|
[FieldMetadataType.CURRENCY]: FieldMetadataTargetColumnMapCurrency;
|
||||||
|
[FieldMetadataType.FULL_NAME]: FieldMetadataTargetColumnMapFullName;
|
||||||
};
|
};
|
||||||
|
|
||||||
type TypeByFieldMetadata<T extends FieldMetadataType | 'default'> =
|
type TypeByFieldMetadata<T extends FieldMetadataType | 'default'> =
|
||||||
|
|||||||
@ -123,6 +123,25 @@ export function convertFieldMetadataToColumnActions(
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
case FieldMetadataType.FULL_NAME: {
|
||||||
|
const defaultValue =
|
||||||
|
fieldMetadata.defaultValue as FieldMetadataDefaultValue<FieldMetadataType.FULL_NAME>;
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||||
|
columnName: fieldMetadata.targetColumnMap.firstName,
|
||||||
|
columnType: 'varchar',
|
||||||
|
defaultValue: serializeDefaultValue(defaultValue?.firstName),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||||
|
columnName: fieldMetadata.targetColumnMap.lastName,
|
||||||
|
columnType: 'varchar',
|
||||||
|
defaultValue: serializeDefaultValue(defaultValue?.lastName),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown type ${fieldMetadata.type}`);
|
throw new Error(`Unknown type ${fieldMetadata.type}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,12 @@ export function generateTargetColumnMap(
|
|||||||
amountMicros: `${columnName}AmountMicros`,
|
amountMicros: `${columnName}AmountMicros`,
|
||||||
currencyCode: `${columnName}CurrencyCode`,
|
currencyCode: `${columnName}CurrencyCode`,
|
||||||
};
|
};
|
||||||
|
case FieldMetadataType.FULL_NAME:
|
||||||
|
return {
|
||||||
|
firstName: `${columnName}FirstName`,
|
||||||
|
lastName: `${columnName}LastName`,
|
||||||
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new BadRequestException(`Unknown type ${type}`);
|
throw new BadRequestException(`Unknown type ${type}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,15 @@ export const validateDefaultValueBasedOnType = (
|
|||||||
typeof defaultValue.currencyCode === 'string'
|
typeof defaultValue.currencyCode === 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
case FieldMetadataType.FULL_NAME:
|
||||||
|
return (
|
||||||
|
typeof defaultValue === 'object' &&
|
||||||
|
'firstName' in defaultValue &&
|
||||||
|
typeof defaultValue.firstName === 'string' &&
|
||||||
|
'lastName' in defaultValue &&
|
||||||
|
typeof defaultValue.lastName === 'string'
|
||||||
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,12 +13,12 @@ export const addPersonTable: WorkspaceMigrationTableAction[] = [
|
|||||||
action: 'alter',
|
action: 'alter',
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
columnName: 'firstName',
|
columnName: 'nameFirstName',
|
||||||
columnType: 'varchar',
|
columnType: 'varchar',
|
||||||
action: WorkspaceMigrationColumnActionType.CREATE,
|
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnName: 'lastName',
|
columnName: 'nameLastName',
|
||||||
columnType: 'varchar',
|
columnType: 'varchar',
|
||||||
action: WorkspaceMigrationColumnActionType.CREATE,
|
action: WorkspaceMigrationColumnActionType.CREATE,
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -14,26 +14,14 @@ const personMetadata = {
|
|||||||
{
|
{
|
||||||
isCustom: false,
|
isCustom: false,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.FULL_NAME,
|
||||||
name: 'firstName',
|
name: 'name',
|
||||||
label: 'First name',
|
label: 'Name',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'firstName',
|
firstName: 'nameFirstName',
|
||||||
|
lastName: 'nameLastName',
|
||||||
},
|
},
|
||||||
description: 'Contact’s first name',
|
description: 'Contact’s name',
|
||||||
icon: 'IconUser',
|
|
||||||
isNullable: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
isCustom: false,
|
|
||||||
isActive: true,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
name: 'lastName',
|
|
||||||
label: 'Last name',
|
|
||||||
targetColumnMap: {
|
|
||||||
value: 'lastName',
|
|
||||||
},
|
|
||||||
description: 'Contact’s last name',
|
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -0,0 +1,35 @@
|
|||||||
|
import { ObjectMetadataInterface } from 'src/workspace/workspace-schema-builder/interfaces/object-metadata.interface';
|
||||||
|
import { FieldMetadataInterface } from 'src/workspace/workspace-schema-builder/interfaces/field-metadata.interface';
|
||||||
|
|
||||||
|
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
|
||||||
|
|
||||||
|
export const fullNameObjectDefinition = {
|
||||||
|
id: FieldMetadataType.FULL_NAME.toString(),
|
||||||
|
nameSingular: 'fullName',
|
||||||
|
namePlural: 'fullName',
|
||||||
|
labelSingular: 'FullName',
|
||||||
|
labelPlural: 'FullName',
|
||||||
|
targetTableName: '',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
id: 'firstName',
|
||||||
|
type: FieldMetadataType.TEXT,
|
||||||
|
objectMetadataId: FieldMetadataType.FULL_NAME.toString(),
|
||||||
|
name: 'firstName',
|
||||||
|
label: 'First Name',
|
||||||
|
targetColumnMap: { value: 'firstName' },
|
||||||
|
isNullable: true,
|
||||||
|
} satisfies FieldMetadataInterface,
|
||||||
|
{
|
||||||
|
id: 'lastName',
|
||||||
|
type: FieldMetadataType.TEXT,
|
||||||
|
objectMetadataId: FieldMetadataType.FULL_NAME.toString(),
|
||||||
|
name: 'lastName',
|
||||||
|
label: 'Last Name',
|
||||||
|
targetColumnMap: { value: 'lastName' },
|
||||||
|
isNullable: true,
|
||||||
|
} satisfies FieldMetadataInterface,
|
||||||
|
],
|
||||||
|
fromRelations: [],
|
||||||
|
toRelations: [],
|
||||||
|
} satisfies ObjectMetadataInterface;
|
||||||
@ -2,6 +2,7 @@ import { Injectable, Logger } from '@nestjs/common';
|
|||||||
|
|
||||||
import { FieldMetadataEntity } from 'src/metadata/field-metadata/field-metadata.entity';
|
import { FieldMetadataEntity } from 'src/metadata/field-metadata/field-metadata.entity';
|
||||||
import { customTableDefaultColumns } from 'src/workspace/workspace-migration-runner/utils/custom-table-default-column.util';
|
import { customTableDefaultColumns } from 'src/workspace/workspace-migration-runner/utils/custom-table-default-column.util';
|
||||||
|
import { fullNameObjectDefinition } from 'src/workspace/workspace-schema-builder/object-definitions/full-name.object-definition';
|
||||||
|
|
||||||
import { TypeDefinitionsStorage } from './storages/type-definitions.storage';
|
import { TypeDefinitionsStorage } from './storages/type-definitions.storage';
|
||||||
import {
|
import {
|
||||||
@ -63,6 +64,7 @@ export class TypeDefinitionsGenerator {
|
|||||||
const staticObjectMetadataCollection = [
|
const staticObjectMetadataCollection = [
|
||||||
currencyObjectDefinition,
|
currencyObjectDefinition,
|
||||||
linkObjectDefinition,
|
linkObjectDefinition,
|
||||||
|
fullNameObjectDefinition,
|
||||||
];
|
];
|
||||||
|
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user