This commit is contained in:
2025-11-15 08:41:35 +03:30
parent 15c0c508b9
commit 0f1407c748
23 changed files with 714 additions and 177 deletions
+41 -39
View File
@@ -1,53 +1,55 @@
import { IsString, IsNotEmpty, IsBoolean, IsNumber, MinLength } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsString, IsOptional, IsBoolean, IsNumber } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
/**
* DTO for updating user profile.
* Mirrors fields defined on the User entity and keeps everything optional
* to allow partial updates.
*/
export class UpdateUserDto {
@ApiProperty({ example: ' ', description: "User's first name" })
@IsNotEmpty()
@ApiPropertyOptional({ description: "User's first name", example: 'John' })
@IsOptional()
@IsString()
firstName: string;
firstName?: string;
@ApiProperty({ example: ' ', description: "User's last name" })
@IsNotEmpty()
@ApiPropertyOptional({ description: "User's last name", example: 'Doe' })
@IsOptional()
@IsString()
lastName: string;
lastName?: string;
@ApiProperty({ example: ' ', description: "User's father's name" })
@IsNotEmpty()
@ApiPropertyOptional({ description: "User's birth date (ISO)", example: '1990-01-01' })
@IsOptional()
// keep as string here, caller should send ISO date; service will assign to Date
@IsString()
fatherName: string;
birthDate?: string;
// --- Personal Details ---
@ApiPropertyOptional({ description: "User's marriage date (ISO)", example: '2015-06-01' })
@IsOptional()
@IsString()
marriageDate?: string;
@ApiPropertyOptional({ example: true, description: 'Gender: true for male, false for female' })
@IsNotEmpty()
@ApiPropertyOptional({ description: "Referrer's identifier (optional)", example: 'abc123' })
@IsOptional()
@IsString()
referrer?: string;
@ApiPropertyOptional({ description: 'Is the user active?', example: true })
@IsOptional()
@IsBoolean()
isMale: boolean;
isActive?: boolean;
@ApiPropertyOptional({ example: '1234567890', description: 'Unique national code' })
@IsNotEmpty()
@MinLength(10)
nationalCode: string;
@ApiPropertyOptional({ description: 'Gender flag (boolean)', example: true })
@IsOptional()
@IsBoolean()
gender?: boolean;
@ApiPropertyOptional({ example: '1001', description: 'Employee personal code' })
@IsNotEmpty()
@IsString()
personalCode: string;
// --- Employment Details ---
@ApiPropertyOptional({ example: 'قراردادی', description: 'Type of hire (e.g., permanent, temporary)' })
@IsNotEmpty()
@IsString()
hireType: string;
@ApiPropertyOptional({ example: 'اراک', description: 'Primary work location' })
@IsNotEmpty()
@IsString()
workLocation: string;
@ApiPropertyOptional({ example: 5, description: 'Years of work experience' })
@IsNotEmpty()
@ApiPropertyOptional({ description: 'Wallet balance (integer)', example: 0 })
@IsOptional()
@IsNumber()
workExperienceYear: number;
wallet?: number;
@ApiPropertyOptional({ description: 'Reward points (integer)', example: 0 })
@IsOptional()
@IsNumber()
points?: number;
}