import { ApiProperty, PickType } from "@nestjs/swagger"; import { IsEnum, IsInt, IsNotEmpty, IsNumberString, IsString } from "class-validator"; import { FinancialMessage } from "../../../common/enums/message.enum"; import { CompleteRegistrationDto } from "../../auth/DTO/complete-register.dto"; import { GenderEnum } from "../enums/gender-type.enum"; import { NationalityEnum } from "../enums/nationality.enum"; export class CreateRealUserDto extends PickType(CompleteRegistrationDto, ["firstName", "lastName", "birthDate", "nationalCode", "phone"]) { @IsNotEmpty({ message: FinancialMessage.GENDER_TYPE_REQUIRED }) @IsEnum(GenderEnum) @ApiProperty({ enum: GenderEnum, description: "Gender type", example: GenderEnum.MALE }) gender: GenderEnum; @IsNotEmpty({ message: FinancialMessage.FATHER_NAME_REQUIRED }) @IsString({ message: FinancialMessage.FATHER_NAME_INVALID }) @ApiProperty({ description: "Father name" }) fatherName: string; @IsNotEmpty({ message: FinancialMessage.NATIONALITY_REQUIRED }) @IsEnum(NationalityEnum) @ApiProperty({ description: "Nationality" }) nationality: NationalityEnum; //for address entity @IsNotEmpty({ message: FinancialMessage.ADDRESS_REQUIRED }) @IsString({ message: FinancialMessage.ADDRESS_STRING }) @ApiProperty({ description: "Address" }) address: string; @IsNotEmpty({ message: FinancialMessage.POSTAL_CODE_REQUIRED }) @IsNumberString({ no_symbols: true }, { message: FinancialMessage.POSTAL_CODE_NUMBER_STRING }) @ApiProperty({ description: "Postal code", example: "1234567890" }) postalCode: string; @IsNotEmpty({ message: FinancialMessage.CITY_ID_REQUIRED }) @IsInt({ message: FinancialMessage.CITY_ID_INVALID }) @ApiProperty({ description: "City ID", example: "1" }) cityId: number; }