Skip to content

Commit d3e7c97

Browse files
authored
Merge pull request #37 from DDD-Community/feature/POLABO-130
fix: 4차 MVP 수정
2 parents 996caa5 + 8bf27cf commit d3e7c97

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/main/kotlin/com/ddd/sonnypolabobe/domain/board/controller/dto/BoardGetResponse.kt

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ data class BoardGetResponse(
88
val title: String,
99
@field:Schema(description = "폴라로이드")
1010
val items: List<PolaroidGetResponse>,
11+
@field:Schema(description = "작성자 여부", example = "true")
12+
val isMine : Boolean
1113
)

src/main/kotlin/com/ddd/sonnypolabobe/domain/board/repository/BoardJooqRepositoryImpl.kt

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class BoardJooqRepositoryImpl(
5353
.select(
5454
jBoard.ID.convertFrom { it?.let{UuidConverter.byteArrayToUUID(it) } },
5555
jBoard.TITLE,
56+
jBoard.USER_ID.`as`(BoardGetOneVo::ownerId.name),
5657
jPolaroid.ID.`as`(BoardGetOneVo::polaroidId.name),
5758
jPolaroid.IMAGE_KEY,
5859
jPolaroid.ONE_LINE_MESSAGE,

src/main/kotlin/com/ddd/sonnypolabobe/domain/board/repository/vo/BoardGetOneVo.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import java.util.UUID
66
data class BoardGetOneVo(
77
val id: UUID?,
88
val title: String?,
9+
val ownerId: Long?,
910
val polaroidId : Long?,
1011
val imageKey : String?,
1112
val oneLineMessage: String?,
1213
val createdAt: LocalDateTime?,
1314
val userId : Long?,
14-
val nickName: String?,
15+
val nickname: String?,
1516
val options: String?
1617
)

src/main/kotlin/com/ddd/sonnypolabobe/domain/board/service/BoardService.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class BoardService(
3232
return id.run {
3333
val queryResult =
3434
boardJooqRepository.selectOneById(UuidConverter.stringToUUID(this@run))
35+
if(queryResult.isEmpty()) throw ApplicationException(CustomErrorCode.BOARD_NOT_FOUND)
3536
val groupByTitle = queryResult.groupBy { it.title }
3637
groupByTitle.map { entry ->
3738
val title = entry.key
@@ -41,14 +42,14 @@ class BoardService(
4142
imageUrl = it.imageKey?.let { it1 -> s3Util.getImgUrl(it1) } ?: "",
4243
oneLineMessage = it.oneLineMessage ?: "폴라보와의 추억 한 줄",
4344
userId = it.userId ?: 0L,
44-
nickname = it.nickName ?: "",
45+
nickname = it.nickname ?: "",
4546
isMine = it.userId == user?.id?.toLong(),
4647
createdAt = it.createdAt,
4748
options = it.options?.let{ ObjectMapper().readValue(it, object : TypeReference<Map<PolaroidOption, String>>() {})}
4849

4950
)
5051
}.filter { it.id != 0L }.distinctBy { it.id }
51-
BoardGetResponse(title = title ?: "", items = polaroids)
52+
BoardGetResponse(title = title ?: "", items = polaroids, isMine = queryResult.first().ownerId == user?.id?.toLong())
5253
}
5354
}
5455
}

0 commit comments

Comments
 (0)