Skip to content

Commit

Permalink
[feat] 팜클럽 생성 가능 여부 api 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchoGreenT committed Jul 26, 2024
1 parent 102929a commit 260d598
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,11 @@ public BaseResponseDto<?> withdrawFarmClub(
farmClubService.withdrawFarmClub(farmClubId, user.getUserId(), deleteVeggie);
return BaseResponseDto.of(SuccessCode.SUCCESS, null);
}

@GetMapping("/check")
public BaseResponseDto<?> createFarmClubCheck(
@AuthenticationPrincipal CustomUser user
) {
return BaseResponseDto.of(SuccessCode.SUCCESS, farmClubService.checkCreateFarmClub(user.getUserId()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ public class FarmClubService {
private final MissionPostRepository missionPostRepository;
private final FarmClubRepository farmClubRepository;

public CreateFarmClubCheckResponseDto checkCreateFarmClub(Long userId) {
List<MyVeggieVo> myVeggieList = myVeggieHelper.getMyVeggieInfo(userId);
log.info("myVeggieList: {}", myVeggieList);
if (!myVeggieList.isEmpty()) {
return CreateFarmClubCheckResponseDto.of(true, 0L);
} else {
if (myVeggieHelper.checkMyVeggie(userId)) {
return CreateFarmClubCheckResponseDto.of(false, 1L);
} else {
return CreateFarmClubCheckResponseDto.of(false, 2L);

}
}
}

@Transactional
public CreateFarmClubResponseDto createFarmClub(CreateFarmClubRequestDto request, Long userId) {
// 몽고에서 이미지, 난이도 가져오기
Expand Down

0 comments on commit 260d598

Please sign in to comment.