Files
twenty/packages/twenty-server/src/engine/metadata-modules/object-metadata/dtos/update-object.input.ts
T
Marie d51a797d91 Replace shouldSyncNameAndLabel with isLabelSyncedWithName (#8067)
For consistency. 
This was not deployed yet so allowing myself just to rename everything,
meaning developers will need to reset their db.
2024-10-25 18:28:58 +02:00

89 lines
1.9 KiB
TypeScript

import { Field, InputType } from '@nestjs/graphql';
import { BeforeUpdateOne } from '@ptc-org/nestjs-query-graphql';
import {
IsBoolean,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
} from 'class-validator';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { IsValidMetadataName } from 'src/engine/decorators/metadata/is-valid-metadata-name.decorator';
import { BeforeUpdateOneObject } from 'src/engine/metadata-modules/object-metadata/hooks/before-update-one-object.hook';
@InputType()
export class UpdateObjectPayload {
@IsString()
@IsOptional()
@Field({ nullable: true })
labelSingular?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
labelPlural?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
@IsValidMetadataName()
nameSingular?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
@IsValidMetadataName()
namePlural?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
description?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
icon?: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
shortcut?: string;
@IsBoolean()
@IsOptional()
@Field({ nullable: true })
isActive?: boolean;
@IsUUID()
@IsOptional()
@Field({ nullable: true })
labelIdentifierFieldMetadataId?: string;
@IsUUID()
@IsOptional()
@Field({ nullable: true })
imageIdentifierFieldMetadataId?: string;
@IsBoolean()
@IsOptional()
@Field({ nullable: true })
isLabelSyncedWithName?: boolean;
}
@InputType()
@BeforeUpdateOne(BeforeUpdateOneObject)
export class UpdateOneObjectInput {
@Field(() => UpdateObjectPayload)
update: UpdateObjectPayload;
@IsNotEmpty()
@Field(() => UUIDScalarType, {
description: 'The id of the object to update',
})
@IsUUID()
id!: string;
}