Files
esg/src/inquiry/dto/sayah-request.dto.ts
2026-06-10 15:11:24 +03:30

28 lines
929 B
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsIn, IsNotEmpty, IsOptional, IsString, Length, Matches } from 'class-validator';
export class SayahRequestDto {
@ApiProperty({ example: '1', description: '1 for natural person (always use "1")' })
@IsString()
@IsIn(['1'])
accountOwnerType!: string;
@ApiProperty({ example: '4311402422', description: 'Iranian national code (10 digits)' })
@IsString()
@IsNotEmpty()
@Length(10, 10)
@Matches(/^\d{10}$/, { message: 'nationalId must be exactly 10 digits' })
nationalId!: string;
@ApiPropertyOptional({ nullable: true })
@IsOptional()
@IsString()
legalId?: string | null;
@ApiProperty({ example: 'IR800560611828005105117001', description: 'Iranian Sheba ID (26 characters)' })
@IsString()
@Length(26, 26)
@Matches(/^IR\d{24}$/, { message: 'shebaId must start with IR and contain 24 digits' })
shebaId!: string;
}