2026-08-29 21:06:30 +03:30
|
|
|
import { Type } from 'class-transformer';
|
|
|
|
|
import {
|
|
|
|
|
IsArray,
|
|
|
|
|
IsBoolean,
|
|
|
|
|
IsEnum,
|
|
|
|
|
IsInt,
|
|
|
|
|
IsOptional,
|
|
|
|
|
IsString,
|
|
|
|
|
MaxLength,
|
|
|
|
|
Min,
|
|
|
|
|
MinLength,
|
|
|
|
|
} from 'class-validator';
|
|
|
|
|
|
|
|
|
|
export enum CustomFieldEntityDto {
|
|
|
|
|
person = 'person',
|
|
|
|
|
company = 'company',
|
|
|
|
|
deal = 'deal',
|
2026-11-01 15:38:05 +03:30
|
|
|
note = 'note',
|
2026-08-29 21:06:30 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum CustomFieldTypeDto {
|
|
|
|
|
text = 'text',
|
|
|
|
|
number = 'number',
|
|
|
|
|
date = 'date',
|
|
|
|
|
boolean = 'boolean',
|
|
|
|
|
select = 'select',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class ListCustomFieldsQueryDto {
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsEnum(CustomFieldEntityDto)
|
|
|
|
|
entityType?: CustomFieldEntityDto;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@Type(() => Boolean)
|
|
|
|
|
@IsBoolean()
|
|
|
|
|
activeOnly?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class CreateCustomFieldDto {
|
|
|
|
|
@IsEnum(CustomFieldEntityDto)
|
|
|
|
|
entityType!: CustomFieldEntityDto;
|
|
|
|
|
|
|
|
|
|
@IsString()
|
|
|
|
|
@MinLength(1)
|
|
|
|
|
@MaxLength(120)
|
|
|
|
|
label!: string;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsString()
|
|
|
|
|
@MinLength(1)
|
|
|
|
|
@MaxLength(64)
|
|
|
|
|
key?: string;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsEnum(CustomFieldTypeDto)
|
|
|
|
|
fieldType?: CustomFieldTypeDto;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsArray()
|
|
|
|
|
@IsString({ each: true })
|
|
|
|
|
options?: string[];
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsBoolean()
|
|
|
|
|
required?: boolean;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@Type(() => Number)
|
|
|
|
|
@IsInt()
|
|
|
|
|
@Min(0)
|
|
|
|
|
position?: number;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsBoolean()
|
|
|
|
|
isActive?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class UpdateCustomFieldDto {
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsString()
|
|
|
|
|
@MinLength(1)
|
|
|
|
|
@MaxLength(120)
|
|
|
|
|
label?: string;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsEnum(CustomFieldTypeDto)
|
|
|
|
|
fieldType?: CustomFieldTypeDto;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsArray()
|
|
|
|
|
@IsString({ each: true })
|
|
|
|
|
options?: string[];
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsBoolean()
|
|
|
|
|
required?: boolean;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@Type(() => Number)
|
|
|
|
|
@IsInt()
|
|
|
|
|
@Min(0)
|
|
|
|
|
position?: number;
|
|
|
|
|
|
|
|
|
|
@IsOptional()
|
|
|
|
|
@IsBoolean()
|
|
|
|
|
isActive?: boolean;
|
|
|
|
|
}
|