Skip to content

Commit

Permalink
♻️ 유실물 상세 조회 시, lostType 필드 추가 (#293) (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
discphy authored Dec 13, 2024
1 parent d03f356 commit ab4fc56
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package backend.team.ahachul_backend.api.lost.adapter.web.`in`.dto

import backend.team.ahachul_backend.api.lost.domain.entity.LostPostEntity
import backend.team.ahachul_backend.api.lost.domain.model.LostStatus
import backend.team.ahachul_backend.api.lost.domain.model.LostType
import backend.team.ahachul_backend.common.dto.ImageDto
import java.time.format.DateTimeFormatter

Expand All @@ -24,7 +25,8 @@ class GetLostPostDto {
val categoryName: String?,
val externalSourceImageUrl: String?,
val recommendPosts: List<RecommendResponse>,
val isFromLost112: Boolean
val isFromLost112: Boolean,
val lostType: LostType
) {
companion object {
fun of(entity: LostPostEntity, commentCnt: Int, images: List<ImageDto>, recommendPosts: List<RecommendResponse>): Response {
Expand All @@ -45,7 +47,8 @@ class GetLostPostDto {
categoryName = entity.category?.name,
externalSourceImageUrl = entity.externalSourceFileUrl,
recommendPosts = recommendPosts,
isFromLost112 = entity.isFromLost112()
isFromLost112 = entity.isFromLost112(),
lostType = entity.lostType
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class LostPostControllerDocsTest: CommonDocsTestConfig() {
externalSourceImageUrl = "http://lost112/image.png",
recommendPosts = listOf(recommendPost),
isFromLost112 = true,
lostType = LostType.LOST,
)

given(lostPostUseCase.getLostPost(anyLong()))
Expand Down Expand Up @@ -88,6 +89,7 @@ class LostPostControllerDocsTest: CommonDocsTestConfig() {
fieldWithPath("result.subwayLineId").type(JsonFieldType.NUMBER).description("유실 호선"),
fieldWithPath("result.commentCnt").type(JsonFieldType.NUMBER).description("유실물 쪽지 개수"),
fieldWithPath("result.isFromLost112").type(JsonFieldType.BOOLEAN).description("Lost112 여부"),
fieldWithPath("result.lostType").type(JsonFieldType.STRING).description("유실물 타입").attributes(getFormatAttribute("LOST(유실) / ACQUIRE(습득)")),
fieldWithPath("result.status").type(JsonFieldType.STRING).description("유실물 찾기 완료 여부").attributes(getFormatAttribute( "PROGRESS / COMPLETE")),
fieldWithPath("result.storage" ).type(JsonFieldType.STRING).description("보관 장소").attributes(getFormatAttribute("Lost112 데이터")),
fieldWithPath("result.storageNumber").type(JsonFieldType.STRING).description("보관 장소 전화번호").attributes(getFormatAttribute("Lost112 데이터")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class LostPostServiceTest(
assertThat(response.writer).isEqualTo("nickname")
assertThat(response.subwayLineId).isEqualTo(subwayLine.id)
assertThat(response.status).isEqualTo(LostStatus.PROGRESS)
assertThat(response.lostType).isEqualTo(LostType.ACQUIRE)
}

@Test
Expand Down

0 comments on commit ab4fc56

Please sign in to comment.