Skip to content

Commit

Permalink
feat: 회원 정보 조회 API 추가 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaesung authored Dec 27, 2023
1 parent 7dba582 commit 4971277
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/kotlin/com/poseplz/server/domain/member/MemberVo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package com.poseplz.server.domain.member

data class MemberVo(
val memberId: Long,
val name: String?,
val profileImageUrl: String?,
val status: MemberStatus,
) {
companion object {
fun from(member: Member) = MemberVo(
memberId = member.memberId,
name = member.name,
profileImageUrl = member.profileImageUrl,
status = member.status
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -29,4 +30,16 @@ class MemberController(
),
)
}

@Operation(summary = "회원 정보 조회", description = "회원 정보를 조회합니다.")
@GetMapping("/{memberId:\\d+}")
fun getMemberInfo(
@PathVariable memberId: Long,
): ApiResponse<MemberResponse> {
return ApiResponse.success(
data = MemberResponse.from(
memberApplicationService.getMember(memberId),
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import com.poseplz.server.ui.api.member.MemberResponse as MemberResponse1

data class MemberResponse(
val memberId: String,
val name: String?,
val profileImageUrl: String?,
val status: String,
) {
companion object {
fun from(memberVo: MemberVo) = MemberResponse1(
memberId = memberVo.memberId.toString(),
name = memberVo.name,
profileImageUrl = memberVo.profileImageUrl,
status = memberVo.status.name,
)
}
Expand Down

0 comments on commit 4971277

Please sign in to comment.