Skip to content

Commit

Permalink
Merge pull request #67 from Team-Growthook/feat/#61-member-detail-get…
Browse files Browse the repository at this point in the history
…-api

[FEAT] 회원 정보 조회 API
  • Loading branch information
yeseul106 authored Jan 8, 2024
2 parents 80a663d + b78f11b commit 6d122ed
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.example.growthookserver.api.member.controller;

import com.example.growthookserver.api.member.dto.response.MemberDetailGetResponseDto;
import com.example.growthookserver.api.member.service.MemberService;
import com.example.growthookserver.common.response.ApiResponse;
import com.example.growthookserver.common.response.SuccessStatus;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
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.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("api/v1")
@Tag(name = "Member - 유저 관련 API", description = "Member API Document")
public class MemberController {

private final MemberService memberService;

@GetMapping("/member/{memberId}/profile")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "MemberProfileGet", description = "멤버 프로필을 조회하는 API입니다.")
public ApiResponse<MemberDetailGetResponseDto> getMemberProfile(@PathVariable("memberId") Long memberId) {
return ApiResponse.success(SuccessStatus.GET_MEMBER_PROFILE, memberService.getMemberProfile(memberId));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.growthookserver.api.member.dto.response;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(staticName = "of")
public class MemberDetailGetResponseDto {
private String nickname;
private String email;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.growthookserver.api.member.service;

import com.example.growthookserver.api.member.dto.response.MemberDetailGetResponseDto;

public interface MemberService {
//* 멤버 프로필 정보 조회
MemberDetailGetResponseDto getMemberProfile(Long memberId);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.growthookserver.api.member.service;

import com.example.growthookserver.api.member.domain.Member;
import com.example.growthookserver.api.member.dto.response.MemberDetailGetResponseDto;
import com.example.growthookserver.api.member.repository.MemberRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class MemberServiceImpl implements MemberService{

private final MemberRepository memberRepository;

@Override
public MemberDetailGetResponseDto getMemberProfile(Long memberId) {
Member member = memberRepository.findMemberByIdOrThrow(memberId);
return MemberDetailGetResponseDto.of(member.getNickname(), member.getEmail());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ApiResponse createReview(@PathVariable("actionPlanId") Long actionPlanId,

@GetMapping("actionplan/{actionPlanId}/review")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "ReveiwGet", description = "리뷰 상세 조회 API입니다.")
@Operation(summary = "ReviewGet", description = "리뷰 상세 조회 API입니다.")
public ApiResponse<ReviewDetailGetResponseDto> getReviewDetail(@PathVariable("actionPlanId") Long actionPlanId) {
return ApiResponse.success(SuccessStatus.GET_REVIEW_DETAIL, reviewService.getReviewDetail(actionPlanId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public enum SuccessStatus {
*/
POST_REVIEW_SUCCESS(HttpStatus.CREATED, "리뷰 생성 성공"),
GET_REVIEW_DETAIL(HttpStatus.OK, "리뷰 내용 상세 조회 성공"),

/**
* member
*/
GET_MEMBER_PROFILE(HttpStatus.OK, "멤버 프로필 정보 조회 성공"),
;

private final HttpStatus httpStatus;
Expand Down

0 comments on commit 6d122ed

Please sign in to comment.