* fix: wip better field metadata validation * fix: remove files * fix: default value and options validation * fix: small fix * fix: try to limit patch * fix: tests * Update server/src/metadata/field-metadata/validators/is-field-metadata-options.validator.ts Co-authored-by: Weiko <corentin@twenty.com> * fix: lint * fix: standard fields update security --------- Co-authored-by: Weiko <corentin@twenty.com>
28 lines
669 B
TypeScript
28 lines
669 B
TypeScript
import { Field, InputType, OmitType } from '@nestjs/graphql';
|
|
|
|
import { IsUUID, ValidateNested } from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
|
|
import { FieldMetadataDTO } from 'src/metadata/field-metadata/dtos/field-metadata.dto';
|
|
|
|
@InputType()
|
|
export class CreateFieldInput extends OmitType(
|
|
FieldMetadataDTO,
|
|
['id', 'createdAt', 'updatedAt'] as const,
|
|
InputType,
|
|
) {
|
|
@IsUUID()
|
|
@Field()
|
|
objectMetadataId: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class CreateOneFieldMetadataInput {
|
|
@Type(() => CreateFieldInput)
|
|
@ValidateNested()
|
|
@Field(() => CreateFieldInput, {
|
|
description: 'The record to create',
|
|
})
|
|
field!: CreateFieldInput;
|
|
}
|