Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 4차 MVP 수정 #37

Merged
merged 1 commit into from
Sep 24, 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
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