* Convert metadata tables to camelCase * datasourcemetadataid to datasourceid * refactor metadata folders * fix command * move commands out of metadata * fix seed * rename objectId and fieldId in objectMetadataId and fieldMetadataId in FE * fix field-metadata * Fix * Fix * remove logs --------- Co-authored-by: Charles Bochet <charles@twenty.com>
55 lines
1.2 KiB
TypeScript
55 lines
1.2 KiB
TypeScript
import { Field, HideField, InputType } from '@nestjs/graphql';
|
|
|
|
import { BeforeCreateOne } from '@ptc-org/nestjs-query-graphql';
|
|
import {
|
|
IsEnum,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
} from 'class-validator';
|
|
|
|
import { FieldMetadataTargetColumnMap } from 'src/tenant/schema-builder/interfaces/field-metadata-target-column-map.interface';
|
|
|
|
import { FieldMetadataType } from 'src/database/typeorm/metadata/entities/field-metadata.entity';
|
|
import { BeforeCreateOneField } from 'src/metadata/field-metadata/hooks/before-create-one-field.hook';
|
|
|
|
@InputType()
|
|
@BeforeCreateOne(BeforeCreateOneField)
|
|
export class CreateFieldInput {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@Field()
|
|
name: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@Field()
|
|
label: string;
|
|
|
|
@IsEnum(FieldMetadataType)
|
|
@IsNotEmpty()
|
|
@Field(() => FieldMetadataType)
|
|
type: FieldMetadataType;
|
|
|
|
@IsUUID()
|
|
@Field()
|
|
objectMetadataId: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
@Field({ nullable: true })
|
|
description?: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
@Field({ nullable: true })
|
|
icon?: string;
|
|
|
|
@HideField()
|
|
targetColumnMap: FieldMetadataTargetColumnMap;
|
|
|
|
@HideField()
|
|
workspaceId: string;
|
|
}
|