From 5b0d06526ca75fa1871e101cf8020940eb6df995 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Sat, 24 Aug 2024 17:39:00 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=ED=8C=9C=ED=81=B4=EB=9F=BD=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FarmClubController.java | 7 +++++++ .../res/GetFarmClubUserListResponseDto.java | 18 ++++++++++++++++++ .../domain/farmclub/helper/FarmClubHelper.java | 5 +++++ .../farmclub/service/FarmClubService.java | 4 ++++ 4 files changed, 34 insertions(+) create mode 100644 src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubUserListResponseDto.java diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java index 9db1e0b..ab0bb1f 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java @@ -120,6 +120,13 @@ public BaseResponseDto getMissionPostList( return BaseResponseDto.of(SuccessCode.SUCCESS, missionPostService.getMissionPostList(user.getUserId(), farmClubId)); } + @GetMapping("/{farmClubId}/user") + public BaseResponseDto getFarmClubUserList( + @PathVariable Long farmClubId + ) { + return BaseResponseDto.of(SuccessCode.SUCCESS, farmClubService.getFarmClubUserList(farmClubId)); + } + @GetMapping("/mission/{missionPostId}") public BaseResponseDto getMissionPostComments( @AuthenticationPrincipal CustomUser user, diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubUserListResponseDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubUserListResponseDto.java new file mode 100644 index 0000000..a43601d --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubUserListResponseDto.java @@ -0,0 +1,18 @@ +package com.modernfarmer.farmusspring.domain.farmclub.dto.res; + +import com.modernfarmer.farmusspring.domain.farmclub.vo.GetFarmClubUserVo; +import lombok.AccessLevel; +import lombok.Builder; + +import java.util.List; + +@Builder(access = AccessLevel.PRIVATE) +public record GetFarmClubUserListResponseDto( + List userList +) { + public static GetFarmClubUserListResponseDto of(List userList) { + return GetFarmClubUserListResponseDto.builder() + .userList(userList) + .build(); + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/helper/FarmClubHelper.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/helper/FarmClubHelper.java index f3c21cf..89fd9af 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/helper/FarmClubHelper.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/helper/FarmClubHelper.java @@ -1,5 +1,6 @@ package com.modernfarmer.farmusspring.domain.farmclub.helper; +import com.modernfarmer.farmusspring.domain.farmclub.dto.res.GetFarmClubUserListResponseDto; import com.modernfarmer.farmusspring.domain.farmclub.dto.res.GetMyFarmClubListResponseDto; import com.modernfarmer.farmusspring.domain.farmclub.dto.res.GetRecommendFarmClubResponseDto; import com.modernfarmer.farmusspring.domain.farmclub.dto.res.SearchFarmClubResponseDto; @@ -36,6 +37,10 @@ public List getUserFarmClubList(Long userId) { return farmClubRepository.findMyFarmClubList(userId); } + public GetFarmClubUserListResponseDto getFarmClubUserList(Long farmClubId) { + return GetFarmClubUserListResponseDto.of(farmClubRepository.findFarmClubUserList(farmClubId)); + } + public List getRecommendedFarmClubList(String level) { return farmClubRepository.getRecommendedFarmClubList(level); } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java index a4b3321..5db4cd3 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java @@ -143,6 +143,10 @@ public List getMyFarmClubList(Long userId) { return farmClubHelper.getUserFarmClubList(userId); } + public GetFarmClubUserListResponseDto getFarmClubUserList(Long farmClubId) { + return farmClubHelper.getFarmClubUserList(farmClubId); + } + public GetMyVeggieResponseDto getMyVeggieForRegister(Long userId, String veggieInfoId) { MyVeggieVo myVeggie = myVeggieHelper.getMyVeggieInfo(userId, veggieInfoId); return GetMyVeggieResponseDto.of(myVeggie.myVeggieId(), myVeggie.nickname());