Skip to content

Commit

Permalink
fix: add public userDTO to prevent confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Nov 10, 2022
1 parent 4329952 commit 0efd2d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/share/dto/share.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Expose, plainToClass, Type } from "class-transformer";
import { AuthSignInDTO } from "src/auth/dto/authSignIn.dto";
import { FileDTO } from "src/file/dto/file.dto";
import { PublicUserDTO } from "src/user/dto/publicUser.dto";

export class ShareDTO {
@Expose()
Expand All @@ -14,8 +14,8 @@ export class ShareDTO {
files: FileDTO[];

@Expose()
@Type(() => AuthSignInDTO)
creator: AuthSignInDTO;
@Type(() => PublicUserDTO)
creator: PublicUserDTO;

from(partial: Partial<ShareDTO>) {
return plainToClass(ShareDTO, partial, { excludeExtraneousValues: true });
Expand Down
4 changes: 4 additions & 0 deletions backend/src/user/dto/publicUser.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PickType } from "@nestjs/swagger";
import { UserDTO } from "./user.dto";

export class PublicUserDTO extends PickType(UserDTO, ["email"] as const) {}

0 comments on commit 0efd2d8

Please sign in to comment.