import { IsNotEmpty, IsString, IsOptional, IsEmail, MinLength, IsNumber, } from "class-validator"; import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; export class CreateUserDto { @ApiProperty({ description: "نام کاربر", example: "علی" }) @IsNotEmpty({ message: "نام الزامی است" }) @IsString() firstName!: string; @ApiProperty({ description: "نام خانوادگی کاربر", example: "محمدی" }) @IsNotEmpty({ message: "نام خانوادگی الزامی است" }) @IsString() lastName!: string; @ApiProperty({ description: "شماره موبایل", example: "09123456789" }) @IsNotEmpty({ message: "شماره موبایل الزامی است" }) @IsString() mobile!: string; @ApiPropertyOptional({ description: "ایمیل کاربر", example: "ali@example.com", }) @IsOptional() @IsEmail({}, { message: "فرمت ایمیل نامعتبر است" }) email?: string; @ApiPropertyOptional({ description: "رمز عبور", example: "Password123" }) @IsOptional() @IsString() @MinLength(6, { message: "رمز عبور باید حداقل ۶ کاراکتر باشد" }) password?: string; @ApiPropertyOptional({ description: "نقش کاربر", example: "User_PetOwner" }) @IsOptional() @IsString() role?: string; @ApiPropertyOptional({ description: "موجودی اولیه کیف پول", example: 0 }) @IsOptional() @IsNumber({}, { message: "موجودی کیف پول باید عدد باشد" }) walletBalance?: number; } export class UpdateUserDto { @ApiPropertyOptional({ description: "نام کاربر", example: "علی" }) @IsOptional() @IsString() firstName?: string; @ApiPropertyOptional({ description: "نام خانوادگی کاربر", example: "محمدی" }) @IsOptional() @IsString() lastName?: string; @ApiPropertyOptional({ description: "شماره موبایل", example: "09123456789" }) @IsOptional() @IsString() mobile?: string; @ApiPropertyOptional({ description: "ایمیل کاربر", example: "ali@example.com", }) @IsOptional() @IsEmail({}, { message: "فرمت ایمیل نامعتبر است" }) email?: string; @ApiPropertyOptional({ description: "رمز عبور جدید", example: "NewPassword123", }) @IsOptional() @IsString() @MinLength(6, { message: "رمز عبور باید حداقل ۶ کاراکتر باشد" }) password?: string; @ApiPropertyOptional({ description: "نقش کاربر", example: "User_PetOwner" }) @IsOptional() @IsString() role?: string; @ApiPropertyOptional({ description: "موجودی کیف پول", example: 500000 }) @IsOptional() @IsNumber({}, { message: "موجودی کیف پول باید عدد باشد" }) walletBalance?: number; }