Files
aeroresolve_backend/src/modules/auth/dto/user.dto.ts
T

74 lines
1.9 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
IsBoolean,
IsEmail,
IsNotEmpty,
IsOptional,
IsString,
IsUUID,
MinLength,
} from 'class-validator';
export class CreateUserDto {
@ApiProperty({ example: 'john.doe@aeroresolve.com' })
@IsEmail({}, { message: 'Please provide a valid email address' })
@IsNotEmpty({ message: 'Email is required' })
email!: string;
@ApiProperty({ example: 'Password@123' })
@IsString()
@IsNotEmpty({ message: 'Password is required' })
@MinLength(8, { message: 'Password must be at least 8 characters long' })
password!: string;
@ApiProperty({ example: 'John' })
@IsString()
@IsNotEmpty({ message: 'First name is required' })
firstName!: string;
@ApiPropertyOptional({ example: 'Doe' })
@IsString()
@IsOptional()
lastName?: string;
@ApiProperty({ example: '11111111-1111-1111-1111-111111111111' })
@IsUUID('all', { message: 'Valid Role ID (UUID) is required' })
@IsNotEmpty({ message: 'Role ID is required' })
roleId!: string;
@ApiPropertyOptional({ example: true, default: true })
@IsBoolean()
@IsOptional()
isActive?: boolean;
}
export class UpdateUserDto {
@ApiPropertyOptional({ example: 'John' })
@IsString()
@IsOptional()
firstName?: string;
@ApiPropertyOptional({ example: 'Doe' })
@IsString()
@IsOptional()
lastName?: string;
@ApiPropertyOptional({ example: '11111111-1111-1111-1111-111111111111' })
@IsUUID('all', { message: 'Valid Role ID (UUID) is required' })
@IsOptional()
roleId?: string;
@ApiPropertyOptional({ example: true })
@IsBoolean()
@IsOptional()
isActive?: boolean;
}
export class ResetUserPasswordDto {
@ApiProperty({ example: 'NewSecretPass@2026' })
@IsString()
@IsNotEmpty({ message: 'New password is required' })
@MinLength(8, { message: 'Password must be at least 8 characters long' })
newPassword!: string;
}