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

Commit

Permalink
[BugFix] 답글이 부모 댓글보다 먼저 뜨는 버그 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
JangYouJung committed Feb 18, 2024
1 parent a1b4f77 commit 91aa743
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/signature/signature.comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,35 @@ export class SignatureCommentService{
signatureId: number,
) {

// 1. 'cursorId'부터 오름차순 정령된 댓글 'take'만큼 가져오기
// 1. 'cursorId'부터 오름차순 정렬된 댓글 'take'만큼 가져오기
const [comments, total] = await SignatureCommentEntity.findAndCount({
take: cursorPageOptionsDto.take,
where: {
signature: { id: signatureId },
parentComment: { id: cursorPageOptionsDto.cursorId ? MoreThan(cursorPageOptionsDto.cursorId) : null },
parentComment: { id: MoreThan(cursorPageOptionsDto.cursorId) },
},
relations: {
user: { profileImage: true },
parentComment: true,
signature:{
user: true,
}
signature:{ user: true, }
},
order: {
parentComment: { id: "ASC" as any,},
created: 'ASC'
},
});

// 2. 댓글 response dto에 담기
const result = await Promise.all(comments.map(async (comment) => {

const writerProfile = new GetCommentWriterDto();
const getCommentDto = new GetSignatureCommentDto();

// 2-[1] 댓글 작성자 정보 담기
writerProfile._id = comment.user.id;
writerProfile.name = comment.user.nickname;

// 로그인한 사용자가 댓글 작성자(혹은 시그니처 작성자-> 보류)인지 확인
//if( userId == comment.user.id || userId == comment.signature.user.id ) writerProfile.is_writer = true;
// 로그인한 사용자가 댓글 작성자인지 확인
if( userId == comment.user.id ) writerProfile.is_writer = true;

else writerProfile.is_writer = false;
Expand Down

0 comments on commit 91aa743

Please sign in to comment.