다른 회원 프로필 조회 API 추가

This commit is contained in:
2024-09-06 23:39:09 +09:00
parent da3175292b
commit e8cb4c6ea2
4 changed files with 50 additions and 1 deletions

View File

@@ -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!!))
}
}