Files
edr-platform/apps/edr-freight-api/src/modules/companies/dto/create-company.dto.ts
2026-07-04 09:02:49 +00:00

56 lines
1.0 KiB
TypeScript

import { IsString, IsNotEmpty, IsOptional, IsEnum, MaxLength, Length, IsEmail } from 'class-validator';
import { CompanyType, CompanyStatus } from '../entities/company.entity';
import { IsValidPhone } from '../../../common/validators/is-phone-number.validator';
export class CreateCompanyDto {
@IsString()
@IsNotEmpty()
@MaxLength(200)
name!: string;
@IsEnum(CompanyType)
type!: CompanyType;
@IsOptional()
@IsEnum(CompanyStatus)
status?: CompanyStatus;
@IsString()
@IsNotEmpty()
@Length(10, 10, { message: 'TIN must be exactly 10 digits' })
tin!: string;
@IsOptional()
@IsString()
@MaxLength(50)
vatNumber?: string;
@IsOptional()
@IsString()
@MaxLength(32)
country?: string;
@IsOptional()
@IsString()
address?: string;
@IsOptional()
@IsString()
@MaxLength(20)
@IsValidPhone()
phone?: string;
@IsOptional()
@IsEmail()
@MaxLength(150)
email?: string;
@IsOptional()
@IsString()
@MaxLength(200)
website?: string;
@IsOptional()
attributes?: Record<string, any>;
}