Skip to content

Commit

Permalink
[FEAT] 수확한 쑥의 개수 조회 API 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
yeseul106 committed Jan 7, 2024
1 parent 9ddce3a commit 14f2351
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.growthookserver.api.member.controller;

import com.example.growthookserver.api.member.dto.response.MemberDetailGetResponseDto;
import com.example.growthookserver.api.member.dto.response.MemberGatheredSsukGetResponseDto;
import com.example.growthookserver.api.member.dto.response.MemberUsedSsukGetResponseDto;
import com.example.growthookserver.api.member.service.MemberService;
import com.example.growthookserver.common.response.ApiResponse;
Expand Down Expand Up @@ -45,4 +46,11 @@ public ApiResponse deleteMember(@PathVariable("memberId") Long memberId) {
public ApiResponse<MemberUsedSsukGetResponseDto> getUsedSsuk(@PathVariable("memberId") Long memberId) {
return ApiResponse.success(SuccessStatus.GET_MEMBER_USED_SSUK, memberService.getUsedSsuk(memberId));
}

@GetMapping("/member/{memberId}/gathered-ssuk")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "MemberGatheredSsukGet", description = "수확한 쑥의 개수를 조회하는 API입니다.")
public ApiResponse<MemberGatheredSsukGetResponseDto> getGatheredSsuk(@PathVariable("memberId") Long memberId) {
return ApiResponse.success(SuccessStatus.GET_MEMBER_GATHERED_SSUK, memberService.getGatheredSsuk(memberId));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 MemberGatheredSsukGetResponseDto {
private Integer gatheredSsuk;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.growthookserver.api.member.service;

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

public interface MemberService {
Expand All @@ -12,4 +13,7 @@ public interface MemberService {

//* 사용한 쑥의 개수 조회
MemberUsedSsukGetResponseDto getUsedSsuk(Long memberId);

//* 수확한 쑥의 개수 조회
MemberGatheredSsukGetResponseDto getGatheredSsuk(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.example.growthookserver.api.member.domain.Member;
import com.example.growthookserver.api.member.dto.response.MemberDetailGetResponseDto;
import com.example.growthookserver.api.member.dto.response.MemberGatheredSsukGetResponseDto;
import com.example.growthookserver.api.member.dto.response.MemberUsedSsukGetResponseDto;
import com.example.growthookserver.api.member.repository.MemberRepository;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -33,4 +34,10 @@ public MemberUsedSsukGetResponseDto getUsedSsuk(Long memberId) {
Member member = memberRepository.findMemberByIdOrThrow(memberId);
return MemberUsedSsukGetResponseDto.of(member.getUsedSsuk());
}

@Override
public MemberGatheredSsukGetResponseDto getGatheredSsuk(Long memberId) {
Member member = memberRepository.findMemberByIdOrThrow(memberId);
return MemberGatheredSsukGetResponseDto.of(member.getGatheredSsuk());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public enum SuccessStatus {
GET_MEMBER_PROFILE(HttpStatus.OK, "회원 프로필 정보 조회 성공"),
DELETE_MEMBER(HttpStatus.OK, "회원 탈퇴 성공"),
GET_MEMBER_USED_SSUK(HttpStatus.OK, "사용한 쑥의 개수 조회 성공"),
GET_MEMBER_GATHERED_SSUK(HttpStatus.OK, "수확한 쑥의 개수 조회 성공"),
;

private final HttpStatus httpStatus;
Expand Down

0 comments on commit 14f2351

Please sign in to comment.