From 783c02decabe18a7dd3606c65e9b2bab3da224e4 Mon Sep 17 00:00:00 2001 From: Sim-km Date: Sun, 18 May 2025 21:52:40 +0900 Subject: [PATCH] =?UTF-8?q?ASAP-458=20LetterShareStatus=20API=20userId=20n?= =?UTF-8?q?ullable=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `LetterLogApi.getLetterShareStatus` 메서드의 파라미터 `userId`를 nullable로 수정. - `LetterLogController`의 관련 로직 변경: nullable `userId` 지원. - API 문서 스키마 공백 및 포맷 관련 경미한 수정. --- .../bootstrap/web/letter/api/LetterLogApi.kt | 13 ++++++------- .../letter/controller/LetterLogController.kt | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/api/LetterLogApi.kt b/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/api/LetterLogApi.kt index 8e87235..446e5a2 100644 --- a/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/api/LetterLogApi.kt +++ b/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/api/LetterLogApi.kt @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam @Tag(name = "Letter", description = "Letter API") @RequestMapping("/api/v1/letters/logs") interface LetterLogApi { - @Operation(summary = "편지 공유 상태 조회") @GetMapping("/share/status") @ApiResponses( @@ -41,14 +40,14 @@ interface LetterLogApi { content = [ Content( mediaType = "application/json", - schema = Schema(implementation = LetterShareStatusResponse::class) - ) - ] - ) - ] + schema = Schema(implementation = LetterShareStatusResponse::class), + ), + ], + ), + ], ) fun getLetterShareStatus( @RequestParam("letterCode") letterCode: String, - @AccessUser userId: String + @AccessUser userId: String?, ): LetterShareStatusResponse } diff --git a/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/controller/LetterLogController.kt b/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/controller/LetterLogController.kt index ee1e1e9..1d4d6b9 100644 --- a/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/controller/LetterLogController.kt +++ b/Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/letter/controller/LetterLogController.kt @@ -10,18 +10,20 @@ import org.springframework.web.bind.annotation.RestController @RestController class LetterLogController( private val letterLogUsecase: LetterLogUsecase, - private val objectMapper: ObjectMapper + private val objectMapper: ObjectMapper, ) : LetterLogApi { - override fun getLetterShareStatus(letterCode: String, userId: String): LetterShareStatusResponse { - return letterLogUsecase.finLatestLogByLetterCode(letterCode)?.let { - val kakaoWebHookRequest = - objectMapper.readValue(it.logContent, KakaoWebHookRequest::class.java) + override fun getLetterShareStatus( + letterCode: String, + userId: String?, + ): LetterShareStatusResponse = + letterLogUsecase.finLatestLogByLetterCode(letterCode)?.let { + val kakaoWebHookRequest = objectMapper.readValue(it.logContent, KakaoWebHookRequest::class.java) + LetterShareStatusResponse.success( letterId = it.letterId, - shareTarget = kakaoWebHookRequest.chatType + shareTarget = kakaoWebHookRequest.chatType, ) } ?: run { LetterShareStatusResponse.fail() } - } -} \ No newline at end of file +}