Files
swiss-datashare/backend/src/user/dto/user.dto.ts

27 lines
471 B
TypeScript
Raw Normal View History

import { Expose, plainToClass } from "class-transformer";
import { IsEmail, IsNotEmpty, IsString } from "class-validator";
2022-10-10 17:58:42 +02:00
export class UserDTO {
@Expose()
id: string;
@Expose()
firstName: string;
@Expose()
lastName: string;
@Expose()
@IsNotEmpty()
@IsEmail()
email: string;
@IsNotEmpty()
@IsString()
password: string;
2022-10-10 17:58:42 +02:00
from(partial: Partial<UserDTO>) {
return plainToClass(UserDTO, partial, { excludeExtraneousValues: true });
}
}