fix: dto returns

This commit is contained in:
Elias Schneider
2022-10-10 17:58:42 +02:00
parent 4bab33ad8a
commit 02beb66910
9 changed files with 20 additions and 17 deletions

View File

@@ -1,26 +0,0 @@
import { Expose, plainToClass } from "class-transformer";
import { IsEmail, IsNotEmpty, IsString } from "class-validator";
export class AuthDTO {
@Expose()
id: string;
@Expose()
firstName: string;
@Expose()
lastName: string;
@Expose()
@IsNotEmpty()
@IsEmail()
email: string;
@IsNotEmpty()
@IsString()
password: string;
constructor(partial: Partial<AuthDTO>) {
return plainToClass(AuthDTO, partial, { excludeExtraneousValues: true });
}
}

View File

@@ -1,4 +1,4 @@
import { PickType } from "@nestjs/swagger";
import { AuthDTO } from "./auth.dto";
import { UserDTO } from "src/user/dto/user.dto";
export class AuthRegisterDTO extends AuthDTO {}
export class AuthRegisterDTO extends UserDTO {}

View File

@@ -1,7 +1,7 @@
import { PickType } from "@nestjs/swagger";
import { AuthDTO } from "./auth.dto";
import { UserDTO } from "src/user/dto/user.dto";
export class AuthSignInDTO extends PickType(AuthDTO, [
export class AuthSignInDTO extends PickType(UserDTO, [
"email",
"password",
] as const) {}