ÿØÿà JFIF H H ÿÛ C GIF89;
| System: Linux srv913213 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 Current Path : /var/www/talentgenesis_admin_backend/src/admin/user/dto/ |
| Current File : /var/www/talentgenesis_admin_backend/src/admin/user/dto/user.dto.ts |
import { IsString, IsNotEmpty, IsEmail, Matches, MinLength, IsEnum, IsOptional, IsNumber, ValidateIf, IsMobilePhone, Validate, ValidationArguments } from 'class-validator'
import { ApiProperty } from '@nestjs/swagger';
// import { StartsWith } from 'src/helpers/validation/startsWith.validator';
// import { IsPhoneNumberStartingWithProhibitedDigits } from 'src/helpers/validation/phone-number.validator';
export class CreateUserDto {
@ApiProperty()
@IsString()
@IsNotEmpty({message:"Please provide the name"})
name: string;
@IsNotEmpty({message:"Please provide the mobile number"})
@ApiProperty()
phone: string;
@IsNotEmpty({ message: 'Please provide the email id' })
@ApiProperty()
email: string;
@IsString()
@ApiProperty()
@MinLength(5)
password: string;
@ApiProperty()
@IsNumber()
@IsNotEmpty()
roleId: number;
}
export class LoginUserDto {
@IsEmail()
@ApiProperty()
email: string;
@IsString()
@ApiProperty()
@MinLength(5)
password: string;
}
export class UpdateUserDto {
@IsNotEmpty()
@ApiProperty()
@IsNumber()
id: number
@ApiProperty()
@IsNotEmpty({message:"Please provide the name"})
@IsString()
name: string;
@IsNotEmpty({ message: 'Please provide the email id' })
@ApiProperty()
email: string;
@ApiProperty()
@IsNotEmpty({message:"Please provide the role id"})
@IsNumber()
roleId: number;
@IsNotEmpty({message:"Please provide the mobile number"})
@ApiProperty()
phone: string;
}
export class UpdateStatusUserDto {
@IsNumber()
@ApiProperty()
id: number;
@IsNumber()
@ApiProperty()
status: number;
}
function isValidMobileNumber(value: string) {
const allowedDigits = ['0', '1', '2', '3', '4', '5'];
if (!/^\d{10}$/.test(value)) {
return false;
}
if (!allowedDigits.includes(value.charAt(0))) {
return false;
}
return true;
}