feat(admin): implement complete User CRUD with create, edit, delete, and direct wallet adjust capabilities
Deploy Canina / deploy (push) Successful in 1m53s

This commit is contained in:
parsa aghaei committed 2026-08-16 15:16:47 +03:30
1 parent 6ae35efb3e
commit ad854a717b
4 files changed
+970 -206

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
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;
}