Skip to content

Commit

Permalink
Merge pull request #83 from mash-up-kr/yaeoni/my-profile
Browse files Browse the repository at this point in the history
feat; 본인 프로필 조회 API 를 추가해요. (mock 응답)
  • Loading branch information
yaeoni authored Aug 15, 2024
2 parents 219b1a0 + c573643 commit 1f8bc03
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
3 changes: 3 additions & 0 deletions _endpoint_test/http-client.env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"local": {
"host": "localhost:8080"
},
"dev": {
"host": "http://dojo-backend-eb-env.eba-33qhzuax.ap-northeast-2.elasticbeanstalk.com"
}
}
6 changes: 5 additions & 1 deletion _endpoint_test/member.http
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ POST {{host}}/public/member-login
Content-Type: application/json

{
"id": "df34d054-4534-4623-8996-9016162c430b"
"id": "f4b610eb-aa5d-47df-bd2a-d50fd9a94d2a"
}

### 타인 프로필 조회 API
Expand All @@ -24,3 +24,7 @@ GET {{host}}/member/{{memberId}}}

### 타인 프로필 조회 Mock API
GET {{host}}/member/mock/{{memberId}}}

### 내 프로필 조회 API
GET {{host}}/member/me
Authorization: {{authorization}}
16 changes: 16 additions & 0 deletions api/src/main/kotlin/com/mashup/dojo/MemberController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package com.mashup.dojo

import com.mashup.dojo.common.DojoApiResponse
import com.mashup.dojo.config.security.JwtTokenService
import com.mashup.dojo.config.security.MemberPrincipalContextHolder
import com.mashup.dojo.domain.MemberId
import com.mashup.dojo.dto.MemberCreateRequest
import com.mashup.dojo.dto.MemberLoginRequest
import com.mashup.dojo.dto.MemberProfileResponse
import com.mashup.dojo.dto.MemberUpdateRequest
import com.mashup.dojo.dto.MyProfileResponse
import com.mashup.dojo.service.MemberService
import com.mashup.dojo.usecase.MemberUseCase
import io.github.oshai.kotlinlogging.KotlinLogging
Expand Down Expand Up @@ -99,6 +101,20 @@ class MemberController(
)
}

@GetMapping("/member/me")
@Operation(
summary = "본인 프로필 조회 API",
description = "본인 프로필 조회 API, header 토큰에 의해 본인을 식별해요"
)
fun me(): DojoApiResponse<MyProfileResponse> {
val memberId = MemberPrincipalContextHolder.current().id

logger.info { "read my profile, $memberId" }

// TODO 로직 연결
return DojoApiResponse.success(MyProfileResponse.mock())
}

// ToDo 로직 연결 후 추후 제거
@GetMapping("/member/mock/{memberId}")
@Operation(
Expand Down
37 changes: 37 additions & 0 deletions api/src/main/kotlin/com/mashup/dojo/dto/MyProfileResponse.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.mashup.dojo.dto

import io.swagger.v3.oas.annotations.media.Schema

@Schema(description = "프로필 응답 Response")
data class MyProfileResponse(
@Schema(description = "유저 id")
val memberId: String,
@Schema(description = "유저 프로필 이미지 url")
val profileImageUrl: String,
@Schema(description = "유저 이름")
val memberName: String,
@Schema(description = "유저 플랫폼")
val platform: String,
@Schema(description = "유저 기수")
val ordinal: Int,
@Schema(description = "유저가 받은 픽 개수")
val pickCount: Int,
@Schema(description = "유저의 친구 수")
val friendCount: Int,
@Schema(description = "소유한 코인 개수")
val coinCount: Int,
) {
companion object {
fun mock() =
MyProfileResponse(
memberId = "memberI123456754231",
profileImageUrl = "https://t1.daumcdn.net/daumtop_chanel/op/20200723055344399.png",
memberName = "낭은영",
platform = "Product Design",
ordinal = 14,
pickCount = 8186,
friendCount = 1925,
coinCount = 3994
)
}
}

0 comments on commit 1f8bc03

Please sign in to comment.