forked from Yara724/api
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.
43 lines
1023 B
TypeScript
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;
|
|
}
|