From 5de33de391bb6a2c0e5a085fd968fa6e16c1bdfe Mon Sep 17 00:00:00 2001 From: overthestream Date: Tue, 19 Dec 2023 17:12:14 +0900 Subject: [PATCH] Add 'home' property to BlurtingAnswerDto and update likes calculation --- src/dtos/blurtingPage.dto.ts | 3 ++- src/home/home.service.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dtos/blurtingPage.dto.ts b/src/dtos/blurtingPage.dto.ts index 844b33d..db1d36f 100644 --- a/src/dtos/blurtingPage.dto.ts +++ b/src/dtos/blurtingPage.dto.ts @@ -59,6 +59,7 @@ export class BlurtingAnswerDto { room: string, user: UserEntity, ilike: boolean = false, + home: boolean = false, ): BlurtingAnswerDto { return { id: answerEntity.id, @@ -69,7 +70,7 @@ export class BlurtingAnswerDto { postedAt: answerEntity.postedAt, mbti: user?.userInfo?.mbti ?? null, room: room ?? null, - likes: answerEntity.groupLikes, + likes: home ? answerEntity.allLikes : answerEntity.groupLikes, ilike, }; } diff --git a/src/home/home.service.ts b/src/home/home.service.ts index 22c7373..29352de 100644 --- a/src/home/home.service.ts +++ b/src/home/home.service.ts @@ -144,6 +144,7 @@ export class HomeService { null, answerEntity.user, iLike, + true, ), }; }),