user module + servie + controller

This commit is contained in:
2026-06-25 21:49:54 +03:30
parent 5e74ebd27c
commit 2c12a0770b
6 changed files with 154 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { IsEnum, IsNotEmpty, IsString, Length, Matches } from 'class-validator';
import { UserRole } from '../enums/user-role.enum';
export class CreateUserDto {
@IsString()
@Length(1, 100)
@IsNotEmpty()
firstName: string;
@IsString()
@Length(1, 100)
@IsNotEmpty()
lastName: string;
@Matches(/^09\d{9}$/)
mobile: string;
@IsEnum(UserRole)
@IsNotEmpty()
role: UserRole;
}
+28
View File
@@ -0,0 +1,28 @@
import {
IsEnum,
IsOptional,
IsString,
Length,
Matches,
} from 'class-validator';
import { UserRole } from '../enums/user-role.enum';
export class UpdateUserDto {
@IsOptional()
@IsString()
@Length(1, 100)
firstName?: string;
@IsOptional()
@IsString()
@Length(1, 100)
lastName?: string;
@IsOptional()
@Matches(/^09\d{9}$/)
mobile?: string;
@IsOptional()
@IsEnum(UserRole)
role?: UserRole;
}