Skip to content

Commit

Permalink
Merge pull request #37 from DDD-Community/feature/POLABO-130
Browse files Browse the repository at this point in the history
fix: 4차 MVP 수정
  • Loading branch information
dldmsql authored Sep 24, 2024
2 parents 996caa5 + 8bf27cf commit d3e7c97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ data class BoardGetResponse(
val title: String,
@field:Schema(description = "폴라로이드")
val items: List<PolaroidGetResponse>,
@field:Schema(description = "작성자 여부", example = "true")
val isMine : Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class BoardJooqRepositoryImpl(
.select(
jBoard.ID.convertFrom { it?.let{UuidConverter.byteArrayToUUID(it) } },
jBoard.TITLE,
jBoard.USER_ID.`as`(BoardGetOneVo::ownerId.name),
jPolaroid.ID.`as`(BoardGetOneVo::polaroidId.name),
jPolaroid.IMAGE_KEY,
jPolaroid.ONE_LINE_MESSAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import java.util.UUID
data class BoardGetOneVo(
val id: UUID?,
val title: String?,
val ownerId: Long?,
val polaroidId : Long?,
val imageKey : String?,
val oneLineMessage: String?,
val createdAt: LocalDateTime?,
val userId : Long?,
val nickName: String?,
val nickname: String?,
val options: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class BoardService(
return id.run {
val queryResult =
boardJooqRepository.selectOneById(UuidConverter.stringToUUID(this@run))
if(queryResult.isEmpty()) throw ApplicationException(CustomErrorCode.BOARD_NOT_FOUND)
val groupByTitle = queryResult.groupBy { it.title }
groupByTitle.map { entry ->
val title = entry.key
Expand All @@ -41,14 +42,14 @@ class BoardService(
imageUrl = it.imageKey?.let { it1 -> s3Util.getImgUrl(it1) } ?: "",
oneLineMessage = it.oneLineMessage ?: "폴라보와의 추억 한 줄",
userId = it.userId ?: 0L,
nickname = it.nickName ?: "",
nickname = it.nickname ?: "",
isMine = it.userId == user?.id?.toLong(),
createdAt = it.createdAt,
options = it.options?.let{ ObjectMapper().readValue(it, object : TypeReference<Map<PolaroidOption, String>>() {})}

)
}.filter { it.id != 0L }.distinctBy { it.id }
BoardGetResponse(title = title ?: "", items = polaroids)
BoardGetResponse(title = title ?: "", items = polaroids, isMine = queryResult.first().ownerId == user?.id?.toLong())
}
}
}
Expand Down

0 comments on commit d3e7c97

Please sign in to comment.