Skip to content

Commit

Permalink
Merge pull request #250 from depromeet/feature/#171
Browse files Browse the repository at this point in the history
/goal/explore 댓글 수 수정
  • Loading branch information
ManHyuk authored Apr 5, 2024
2 parents 43b8f31 + abc7ea1 commit c4dba1a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class GoalExploreCountSubset(
) {
constructor(result: GoalExploreQueryResult) : this(
reaction = 0,
comment = 0,
comment = result.commentCount,
task = 0,
goal = result.goalCount,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.raemian.api.goal.service

import io.raemian.api.comment.service.CommentService
import io.raemian.api.emoji.service.EmojiService
import io.raemian.api.event.model.CreatedGoalEvent
import io.raemian.api.event.model.DeletedGoalEvent
Expand Down Expand Up @@ -32,6 +33,7 @@ class GoalService(
private val emojiService: EmojiService,
private val stickerService: StickerService,
private val tagService: TagService,
private val commentService: CommentService,
) {

@Transactional(readOnly = true)
Expand Down Expand Up @@ -98,7 +100,12 @@ class GoalService(
val reactedEmojiMap = emojiService.findAllByGoalIds(goalIds, userId)

return explore
.map { GoalExploreResult.from(it, reactedEmojiMap[it.goalId]) }
.map {
GoalExploreResult.from(
explore = it,
reactedEmojisResponse = reactedEmojiMap[it.goalId],
)
}
}

private fun createFirstLifeMap(userId: Long): LifeMap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ interface GoalRepository : JpaRepository<Goal, Long> {
goal.tag.content,
goal.createdAt,
map.id,
count.goalCount,
count.historyCount,
count.viewCount,
lifeMapCount.goalCount,
lifeMapCount.historyCount,
lifeMapCount.viewCount,
commentCount.count,
user.id,
user.nickname,
user.username,
Expand All @@ -40,11 +41,13 @@ interface GoalRepository : JpaRepository<Goal, Long> {
Goal as goal,
LifeMap as map,
USERS as user,
LifeMapCount as count
LifeMapCount as lifeMapCount,
CommentCount as commentCount
WHERE 1 = 1
AND goal.lifeMap.id = map.id
AND map.user.id = user.id
AND map.id = count.lifeMapId
AND map.id = lifeMapCount.lifeMapId
AND goal.id = commentCount.goalId
AND map.isPublic = true
AND goal.id < :cursor
ORDER BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data class GoalExploreQueryResult(
val goalCount: Long,
val historyCount: Long,
val viewCount: Long,
val commentCount: Long,
val userId: Long,
val nickname: String,
val username: String,
Expand Down

0 comments on commit c4dba1a

Please sign in to comment.