Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Refactor: 시그니처 댓글 삭제 권한 변경 #207 #209

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/signature/dto/comment/get-signature-comment.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class GetSignatureCommentDto{
parentId: number;
content: string;
writer: GetCommentWriterDto;
date: Date; // 생성 | 수정일
is_edited: boolean; // 댓글 수정 여부
date: Date; // 생성 | 수정일
is_edited: boolean; // 댓글 수정 여부
can_delete: boolean; // 로그인한 사용자의 댓글 삭제 권한 여부: 시그니처 작성자면 true
}
9 changes: 9 additions & 0 deletions src/signature/signature.comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ export class SignatureCommentService{
getCommentDto.is_edited = true;
}

// 로그인한 사용자가 시그니처 작성하면 can_delete = true
let can_delete = false;
if(comment.signature.user){ // 시그니처 작성자가 존재할 경우
if(comment.signature.user.id == userId){ // 로그인한 사용자가 시그니처 작성자일 경우 댓글 삭제 가능
can_delete = true;
}
}
getCommentDto.can_delete = can_delete;

return getCommentDto;

}));
Expand Down