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 } }