From 8a385706749633541153c8fdf99447e27a29b4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=9D=B8=EC=A4=80?= <54973090+dlswns2480@users.noreply.github.com> Date: Mon, 16 Dec 2024 00:43:04 +0900 Subject: [PATCH] =?UTF-8?q?[feat=20#200]=20=EC=9C=A0=EC=A0=80=20=EA=B4=80?= =?UTF-8?q?=EC=8B=AC=EC=82=AC=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?API=20(#201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat : 유저 관심사 목록 조회 API * feat : 유저 관심사 목록 조회 로직 구현 --- .../src/main/kotlin/com/pokit/user/UserController.kt | 10 ++++++++++ .../main/kotlin/com/pokit/user/port/in/UserUseCase.kt | 3 +++ .../kotlin/com/pokit/user/port/service/UserService.kt | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/adapters/in-web/src/main/kotlin/com/pokit/user/UserController.kt b/adapters/in-web/src/main/kotlin/com/pokit/user/UserController.kt index 1d1e0e1d..ee6cc3ab 100644 --- a/adapters/in-web/src/main/kotlin/com/pokit/user/UserController.kt +++ b/adapters/in-web/src/main/kotlin/com/pokit/user/UserController.kt @@ -98,4 +98,14 @@ class UserController( .toResponse() .wrapOk() } + + @GetMapping("/myinterests") + @Operation(summary = "유저의 관심사 목록 조회 API") + fun getMyInterests( + @AuthenticationPrincipal user: PrincipalUser + ): ResponseEntity> { + return userUseCase.getMyInterests(user.id) + .map { InterestTypeResponse(it.name, it.kor) } + .wrapOk() + } } diff --git a/application/src/main/kotlin/com/pokit/user/port/in/UserUseCase.kt b/application/src/main/kotlin/com/pokit/user/port/in/UserUseCase.kt index c5574c9d..52001e0f 100644 --- a/application/src/main/kotlin/com/pokit/user/port/in/UserUseCase.kt +++ b/application/src/main/kotlin/com/pokit/user/port/in/UserUseCase.kt @@ -5,6 +5,7 @@ import com.pokit.user.dto.request.SignUpRequest import com.pokit.user.dto.request.UpdateNicknameRequest import com.pokit.user.dto.request.UserCommand import com.pokit.user.model.FcmToken +import com.pokit.user.model.InterestType import com.pokit.user.model.User interface UserUseCase { @@ -21,4 +22,6 @@ interface UserUseCase { fun getUserInfo(userId: Long): User fun updateProfile(userId: Long, command: UserCommand): User + + fun getMyInterests(userId: Long): List } diff --git a/application/src/main/kotlin/com/pokit/user/port/service/UserService.kt b/application/src/main/kotlin/com/pokit/user/port/service/UserService.kt index fdcc617a..b7e71324 100644 --- a/application/src/main/kotlin/com/pokit/user/port/service/UserService.kt +++ b/application/src/main/kotlin/com/pokit/user/port/service/UserService.kt @@ -123,4 +123,8 @@ class UserService( user.modifyProfile(image, command.nickname) return userPort.persist(user) } + + override fun getMyInterests(userId: Long) = + interestPort.loadByUserId(userId) + .map { it.interestType } }