Skip to content

Commit

Permalink
feat: Member Role 조회 api 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjy committed Oct 8, 2024
1 parent c2570db commit 4c3f0f1
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
19 changes: 17 additions & 2 deletions src/main/java/com/pyro/yolog/domain/member/api/MemberApi.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pyro.yolog.domain.member.api;

import com.pyro.yolog.domain.member.dto.response.SocialTypeResponse;
import com.pyro.yolog.domain.member.dto.response.MemberRoleResponse;
import com.pyro.yolog.domain.member.dto.response.MemberSocialTypeResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
Expand All @@ -9,6 +10,20 @@

@Tag(name = "Member")
public interface MemberApi {
@Operation(
summary = "회원 Role 조회",
description = "회원의 Role을 조회합니다.",
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "OK"
)
}
)
MemberRoleResponse getRole();

@Operation(
summary = "회원 소셜 타입 조회",
Expand All @@ -23,5 +38,5 @@ public interface MemberApi {
)
}
)
SocialTypeResponse getSocialType();
MemberSocialTypeResponse getSocialType();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pyro.yolog.domain.member.api;

import com.pyro.yolog.domain.member.dto.response.SocialTypeResponse;
import com.pyro.yolog.domain.member.dto.response.MemberRoleResponse;
import com.pyro.yolog.domain.member.dto.response.MemberSocialTypeResponse;
import com.pyro.yolog.domain.member.service.MemberService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
Expand All @@ -9,12 +10,19 @@
@RestController
@RequiredArgsConstructor
@RequestMapping("members")
public class MemberController {
public class MemberController implements MemberApi{
private final MemberService memberService;

@ResponseStatus(HttpStatus.OK)
@GetMapping("social-type")
public SocialTypeResponse getSocialType() {
@GetMapping("/role")
public MemberRoleResponse getRole() {
return memberService.getRole();
}

@ResponseStatus(HttpStatus.OK)
@GetMapping("/social-type")
@Override
public MemberSocialTypeResponse getSocialType() {
return memberService.getSocialType();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.pyro.yolog.domain.member.dto.response;

import com.pyro.yolog.domain.member.entity.Role;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@AllArgsConstructor
@Setter
public class MemberRoleResponse {
private Role role;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.pyro.yolog.domain.member.service;

import com.pyro.yolog.domain.member.dto.response.MemberRoleResponse;
import com.pyro.yolog.global.oauth2.service.AuthService;
import com.pyro.yolog.domain.member.dto.response.SocialTypeResponse;
import com.pyro.yolog.domain.member.dto.response.MemberSocialTypeResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
Expand All @@ -12,7 +13,11 @@
public class MemberService {
private final AuthService authService;

public SocialTypeResponse getSocialType() {
return new SocialTypeResponse(authService.getLoginUser().getSocialType());
public MemberSocialTypeResponse getSocialType() {
return new MemberSocialTypeResponse(authService.getLoginUser().getSocialType());
}

public MemberRoleResponse getRole() {
return new MemberRoleResponse(authService.getLoginUser().getRole());
}
}

0 comments on commit 4c3f0f1

Please sign in to comment.