Files
twenty/server/src/metadata/field-metadata/dtos/create-field.input.ts
Jérémy M 4e993316a6 feat: conditional schema based on column map instead of column field (#1978)
* feat: wip conditional schema based on column map instead of column field

* feat: conditionalSchema columnMap and singular plural

* fix: remove uuid fix

* feat: add name and label (singular/plural) drop old tableColumnName
2023-10-12 18:28:27 +02:00

67 lines
1005 B
TypeScript

import { Field, InputType } from '@nestjs/graphql';
import {
IsEnum,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
} from 'class-validator';
@InputType()
export class CreateFieldInput {
@IsString()
@IsNotEmpty()
@Field()
nameSingular: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
namePlural?: string;
@IsString()
@IsNotEmpty()
@Field()
labelSingular: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
labelPlural?: string;
// Todo: use a type enum and share with typeorm entity
@IsEnum([
'text',
'phone',
'email',
'number',
'boolean',
'date',
'url',
'money',
])
@IsNotEmpty()
@Field()
type: string;
@IsUUID()
@Field()
objectId: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
description?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
icon?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
placeholder?: string;
}