Feat/object metadata item identifiers (#2865)
* Moved pure UI object fields to ui folder * Moved pure UI object fields to ui folder 2 * Updated graphql metadata schema and fixed typing issues * Added a new hook to create a record identifier mapper * Fixed merge main
This commit is contained in:
@ -2,6 +2,8 @@ import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedWorkspaceId } from 'src/database/typeorm-seeds/core/workspaces';
|
||||
import { SeedDataSourceId } from 'src/database/typeorm-seeds/metadata/data-source';
|
||||
import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
|
||||
import { SeedPersonFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/person';
|
||||
|
||||
const tableName = 'objectMetadata';
|
||||
|
||||
@ -44,6 +46,8 @@ export const seedObjectMetadata = async (
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'isSystem',
|
||||
'labelIdentifierFieldMetadataId',
|
||||
'imageIdentifierFieldMetadataId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -60,6 +64,8 @@ export const seedObjectMetadata = async (
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
labelIdentifierFieldMetadataId: SeedCompanyFieldMetadataIds.Name,
|
||||
imageIdentifierFieldMetadataId: SeedCompanyFieldMetadataIds.DomainName,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Person,
|
||||
@ -74,7 +80,31 @@ export const seedObjectMetadata = async (
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
labelIdentifierFieldMetadataId: SeedPersonFieldMetadataIds.Email,
|
||||
imageIdentifierFieldMetadataId: SeedPersonFieldMetadataIds.AvatarUrl,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'id',
|
||||
'nameSingular',
|
||||
'namePlural',
|
||||
'labelSingular',
|
||||
'labelPlural',
|
||||
'targetTableName',
|
||||
'description',
|
||||
'icon',
|
||||
'dataSourceId',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: SeedObjectMetadataIds.Opportunity,
|
||||
nameSingular: 'opportunity',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Field, HideField, InputType } from '@nestjs/graphql';
|
||||
|
||||
import { BeforeCreateOne } from '@ptc-org/nestjs-query-graphql';
|
||||
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
import { IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
import { BeforeCreateOneObject } from 'src/metadata/object-metadata/hooks/before-create-one-object.hook';
|
||||
|
||||
@ -43,4 +43,14 @@ export class CreateObjectInput {
|
||||
|
||||
@HideField()
|
||||
workspaceId: string;
|
||||
|
||||
@IsUUID()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
labelIdentifierFieldMetadataId?: string;
|
||||
|
||||
@IsUUID()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
imageIdentifierFieldMetadataId?: string;
|
||||
}
|
||||
|
||||
@ -67,4 +67,10 @@ export class ObjectMetadataDTO {
|
||||
|
||||
@Field()
|
||||
updatedAt: Date;
|
||||
|
||||
@Field({ nullable: true })
|
||||
labelIdentifierFieldMetadataId: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
imageIdentifierFieldMetadataId: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user