Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.
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 @@ -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(
Expand All @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
}