From 395b6b934bd88129a91bb86ab039a2181193e0a4 Mon Sep 17 00:00:00 2001 From: Jeong Jeongil Date: Fri, 26 Jul 2024 17:36:43 +0900 Subject: [PATCH] Proceeding Fit Certification List By fit group id add multiMediaEndPoints --- .../response/FitCertificationDetailWithVoteResponseDto.kt | 2 +- .../application/service/service/FitCertificationService.kt | 6 +++++- .../api/FitCertificationFilterControllerTest.kt | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/fitmate/myfit/application/port/in/certification/response/FitCertificationDetailWithVoteResponseDto.kt b/src/main/kotlin/com/fitmate/myfit/application/port/in/certification/response/FitCertificationDetailWithVoteResponseDto.kt index 6762b56..d2d9215 100644 --- a/src/main/kotlin/com/fitmate/myfit/application/port/in/certification/response/FitCertificationDetailWithVoteResponseDto.kt +++ b/src/main/kotlin/com/fitmate/myfit/application/port/in/certification/response/FitCertificationDetailWithVoteResponseDto.kt @@ -14,6 +14,6 @@ data class FitCertificationDetailWithVoteResponseDto( val maxAgreeCount: Int, val fitRecordStartDate: Instant, val fitRecordEndDate: Instant, - val thumbnailEndPoint: String?, + val multiMediaEndPoints: List?, val voteEndDate: Instant ) diff --git a/src/main/kotlin/com/fitmate/myfit/application/service/service/FitCertificationService.kt b/src/main/kotlin/com/fitmate/myfit/application/service/service/FitCertificationService.kt index bad95cb..e0602f7 100644 --- a/src/main/kotlin/com/fitmate/myfit/application/service/service/FitCertificationService.kt +++ b/src/main/kotlin/com/fitmate/myfit/application/service/service/FitCertificationService.kt @@ -133,6 +133,9 @@ class FitCertificationService( val fitCertificationDetailDtoList = fitCertificationDetailList.map { val userForRead = getUserForReadPort(it.certificationRequestUserId) + val fitRecord = readFitRecordPort.findById(it.recordId) + .orElseThrow { ResourceNotFoundException("fit record does not exist") } + FitCertificationDetailWithVoteResponseDto( it.certificationId, it.recordId, @@ -145,7 +148,8 @@ class FitCertificationService( it.maxAgreeCount.toInt(), it.fitRecordStartDate, it.fitRecordEndDate, - getRecordThumbnailEndPoint(it.recordId), + readRecordMultiMediaEndPointPort.findByFitRecordAndOrderByIdAsc(fitRecord).stream() + .map { multiMedia -> multiMedia.endPoint }.toList(), it.createdAt.plus(12, ChronoUnit.HOURS) ) }.toList() diff --git a/src/test/kotlin/com/fitmate/myfit/adapter/in/web/certification/api/FitCertificationFilterControllerTest.kt b/src/test/kotlin/com/fitmate/myfit/adapter/in/web/certification/api/FitCertificationFilterControllerTest.kt index b1679b7..97e08c7 100644 --- a/src/test/kotlin/com/fitmate/myfit/adapter/in/web/certification/api/FitCertificationFilterControllerTest.kt +++ b/src/test/kotlin/com/fitmate/myfit/adapter/in/web/certification/api/FitCertificationFilterControllerTest.kt @@ -67,7 +67,7 @@ class FitCertificationFilterControllerTest { i + 13, Instant.now(), Instant.now().plusSeconds(10000), - "https://avatars.githubusercontent.com/u/105261146?v=4", + listOf("https://avatars.githubusercontent.com/u/105261146?v=4"), Instant.now().plusSeconds(1000000) ) ) @@ -119,8 +119,8 @@ class FitCertificationFilterControllerTest { .description("반대 수"), fieldWithPath("fitCertificationDetails[].maxAgreeCount").type(JsonFieldType.NUMBER) .description("최대 투표 수"), - fieldWithPath("fitCertificationDetails[].thumbnailEndPoint").type(JsonFieldType.STRING) - .description("기록 썸네일 사진"), + fieldWithPath("fitCertificationDetails[].multiMediaEndPoints[]").type(JsonFieldType.ARRAY) + .description("기록 사진들"), fieldWithPath("fitCertificationDetails[].fitRecordStartDate").type(JsonFieldType.STRING) .description("기록 시작 일자"), fieldWithPath("fitCertificationDetails[].fitRecordEndDate").type(JsonFieldType.STRING)