* 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
67 lines
1005 B
TypeScript
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;
|
|
}
|