Files
yara724-api/src/profile/dto/user/update-profile.dto.ts
T
SepehrYahyaee 2056412efe fix: harden profile updates and localize public errors in Persian
Preserve actor and user profile fields during partial updates and validate supported personal data.

Add Persian HTTP error handling, validation translations, regression tests, and audit documentation.
2026-11-04 12:03:04 +03:30

43 lines
1023 B
TypeScript

import { ApiPropertyOptional } from "@nestjs/swagger";
import {
IsDateString,
IsIn,
IsOptional,
IsString,
MaxLength,
} from "class-validator";
export class UpdateUserProfileDtoRq {
@ApiPropertyOptional({
description:
"Gregorian birth date (YYYY-MM-DD). Legacy packed Jalali dates are also accepted.",
example: "1999-03-05",
})
@IsOptional()
@IsDateString({ strict: true }, { message: "تاریخ تولد معتبر نیست." })
birthDay?: string;
@ApiPropertyOptional({ enum: ["male", "female"] })
@IsOptional()
@IsIn(["male", "female"], { message: "جنسیت معتبر نیست." })
gender?: "male" | "female";
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(100)
city?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(100)
state?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(1000, { message: "نشانی باید حداکثر ۱۰۰۰ کاراکتر باشد." })
address?: string;
}