Files
CRM_Montzar/apps/api/src/organizations/dto.ts
T

77 lines
1.4 KiB
TypeScript
Raw Normal View History

import {
ArrayMinSize,
IsArray,
IsIn,
IsNumber,
IsOptional,
IsString,
MaxLength,
Min,
MinLength,
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { BUSINESS_FIELDS } from '@mento/shared';
2026-10-17 17:01:52 +03:30
import type { UpdatePriorArchiveCutoffRequest } from '@mento/shared';
export class ExchangeRateInputDto {
@IsString()
@MinLength(3)
@MaxLength(8)
currency!: string;
@Type(() => Number)
@IsNumber()
@Min(0.000001)
rateToBase!: number;
}
export class UpdateOrgCurrenciesDto {
@IsOptional()
@IsString()
@MinLength(3)
@MaxLength(8)
baseCurrency?: string;
@IsOptional()
@IsArray()
@ArrayMinSize(1)
@IsString({ each: true })
enabledCurrencies?: string[];
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => ExchangeRateInputDto)
rates?: ExchangeRateInputDto[];
}
export class CreateOrganizationDto {
@IsString()
@MinLength(2)
@MaxLength(120)
name!: string;
@IsOptional()
@IsIn([...BUSINESS_FIELDS])
businessField?: (typeof BUSINESS_FIELDS)[number];
}
export class UpdateOrganizationDto {
@IsOptional()
@IsString()
@MinLength(2)
@MaxLength(120)
name?: string;
@IsOptional()
@IsIn([...BUSINESS_FIELDS])
businessField?: (typeof BUSINESS_FIELDS)[number];
}
2026-10-17 17:01:52 +03:30
export class UpdatePriorArchiveCutoffDto
implements UpdatePriorArchiveCutoffRequest
{
cutoffAt!: string | null;
}