File

src/module/user/user.dto.ts

Extends

UserDTO

Implements

ICreateUserDTO

Index

Properties

Properties

password
Type : string
Decorators :
@IsString()
email
Type : string
Decorators :
@IsEmail()
Inherited from UserDTO
Defined in UserDTO:30
firstname
Type : string
Decorators :
@IsString()
Inherited from UserDTO
Defined in UserDTO:12
lastname
Type : string
Decorators :
@IsString()
Inherited from UserDTO
Defined in UserDTO:15
roles
Type : Role[]
Decorators :
@IsArray()
@IsEnum(Role, {each: true})
Inherited from UserDTO
Defined in UserDTO:27
tutorials
Type : string[]
Decorators :
@IsArray()
@IsString({each: true})
Inherited from UserDTO
Defined in UserDTO:19
tutorialsToCorrect
Type : string[]
Decorators :
@IsArray()
@IsString({each: true})
Inherited from UserDTO
Defined in UserDTO:23
username
Type : string
Decorators :
@IsString()
Inherited from UserDTO
Defined in UserDTO:33
import { ICreateUserDTO, INewPasswordDTO, IUserDTO } from 'shared/model/User';
import { IsArray, IsEmail, IsEnum, IsNotEmpty, IsString } from 'class-validator';
import { Role } from 'shared/model/Role';

export class PasswordDTO implements INewPasswordDTO {
    @IsNotEmpty()
    password!: string;
}

export class UserDTO implements IUserDTO {
    @IsString()
    firstname!: string;

    @IsString()
    lastname!: string;

    @IsArray()
    @IsString({ each: true })
    tutorials!: string[];

    @IsArray()
    @IsString({ each: true })
    tutorialsToCorrect!: string[];

    @IsArray()
    @IsEnum(Role, { each: true })
    roles!: Role[];

    @IsEmail()
    email!: string;

    @IsString()
    username!: string;
}

export class CreateUserDTO extends UserDTO implements ICreateUserDTO {
    @IsString()
    password!: string;
}

results matching ""

    No results matching ""