다른 회원 프로필 조회 API 추가
This commit is contained in:
@@ -10,6 +10,7 @@ import org.springframework.data.domain.Pageable
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||
import org.springframework.security.core.userdetails.User
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.PostMapping
|
||||
import org.springframework.web.bind.annotation.PutMapping
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
@@ -240,4 +241,13 @@ class MemberController(private val service: MemberService) {
|
||||
fun forgotPassword(
|
||||
@RequestBody request: ForgotPasswordRequest
|
||||
) = ApiResponse.ok(service.forgotPassword(request))
|
||||
|
||||
@GetMapping("/profile/{id}")
|
||||
fun getMemberProfile(
|
||||
@PathVariable id: Long,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
ApiResponse.ok(service.getMemberProfile(memberId = id, myMemberId = member.id!!))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user