Skip to content

Commit

Permalink
[feat #200] 유저 관심사 목록 조회 API (#201)
Browse files Browse the repository at this point in the history
* feat : 유저 관심사 목록 조회 API

* feat : 유저 관심사 목록 조회 로직 구현
  • Loading branch information
dlswns2480 authored Dec 15, 2024
1 parent 317a3e4 commit 8a38570
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions adapters/in-web/src/main/kotlin/com/pokit/user/UserController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,14 @@ class UserController(
.toResponse()
.wrapOk()
}

@GetMapping("/myinterests")
@Operation(summary = "유저의 관심사 목록 조회 API")
fun getMyInterests(
@AuthenticationPrincipal user: PrincipalUser
): ResponseEntity<List<InterestTypeResponse>> {
return userUseCase.getMyInterests(user.id)
.map { InterestTypeResponse(it.name, it.kor) }
.wrapOk()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -21,4 +22,6 @@ interface UserUseCase {
fun getUserInfo(userId: Long): User

fun updateProfile(userId: Long, command: UserCommand): User

fun getMyInterests(userId: Long): List<InterestType>
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

0 comments on commit 8a38570

Please sign in to comment.