From c04770ba60b2cdb500647b050200df5365f65b40 Mon Sep 17 00:00:00 2001 From: leebs0521 Date: Fri, 6 Dec 2024 15:15:37 +0900 Subject: [PATCH] =?UTF-8?q?refactor(volunteer-apply):=20=EC=A7=80=EC=9B=90?= =?UTF-8?q?=20=EB=82=B4=EC=97=AD=EC=9D=B4=20=EC=97=86=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20210=EC=9D=84=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/common/response/ApiResponse.java | 4 ++++ .../VolunteerApplyQueryApiController.java | 22 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/somemore/global/common/response/ApiResponse.java b/src/main/java/com/somemore/global/common/response/ApiResponse.java index 3d82d8bcd..c88f32b39 100644 --- a/src/main/java/com/somemore/global/common/response/ApiResponse.java +++ b/src/main/java/com/somemore/global/common/response/ApiResponse.java @@ -19,6 +19,10 @@ public static ApiResponse ok(int status, T data, String message) { return new ApiResponse<>(status, message, data); } + public static ApiResponse ok(int status, String message) { + return new ApiResponse<>(status, message, ""); + } + public static ApiResponse ok(String message) { return new ApiResponse<>(200, message, ""); } diff --git a/src/main/java/com/somemore/volunteerapply/controller/VolunteerApplyQueryApiController.java b/src/main/java/com/somemore/volunteerapply/controller/VolunteerApplyQueryApiController.java index cc29f093b..d302bd216 100644 --- a/src/main/java/com/somemore/volunteerapply/controller/VolunteerApplyQueryApiController.java +++ b/src/main/java/com/somemore/volunteerapply/controller/VolunteerApplyQueryApiController.java @@ -3,14 +3,14 @@ import static org.springframework.data.domain.Sort.Direction.DESC; import com.somemore.auth.annotation.CurrentUser; +import com.somemore.facade.volunteerapply.VolunteerApplyQueryFacadeUseCase; import com.somemore.global.common.response.ApiResponse; +import com.somemore.global.exception.BadRequestException; import com.somemore.volunteerapply.domain.ApplyStatus; import com.somemore.volunteerapply.dto.condition.VolunteerApplySearchCondition; import com.somemore.volunteerapply.dto.response.VolunteerApplyRecruitInfoResponseDto; -import com.somemore.volunteerapply.dto.response.VolunteerApplyResponseDto; import com.somemore.volunteerapply.dto.response.VolunteerApplySummaryResponseDto; import com.somemore.volunteerapply.dto.response.VolunteerApplyVolunteerInfoResponseDto; -import com.somemore.facade.volunteerapply.VolunteerApplyQueryFacadeUseCase; import com.somemore.volunteerapply.usecase.VolunteerApplyQueryUseCase; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -37,16 +37,20 @@ public class VolunteerApplyQueryApiController { @Operation(summary = "특정 모집글 봉사자 지원 단건 조회", description = "특정 모집글에 대한 봉사자 지원을 조회합니다.") @GetMapping("/volunteer-apply/recruit-board/{recruitBoardId}/volunteer/{volunteerId}") - public ApiResponse getVolunteerApplyByRecruitIdAndVolunteerId( + public ApiResponse getVolunteerApplyByRecruitIdAndVolunteerId( @PathVariable Long recruitBoardId, @PathVariable UUID volunteerId ) { - return ApiResponse.ok( - 200, - volunteerApplyQueryUseCase.getVolunteerApplyByRecruitIdAndVolunteerId( - recruitBoardId, volunteerId), - "특정 모집글에 대한 봉사자 지원 단건 조회 성공" - ); + try { + return ApiResponse.ok( + 200, + volunteerApplyQueryUseCase.getVolunteerApplyByRecruitIdAndVolunteerId( + recruitBoardId, volunteerId), + "특정 모집글에 대한 봉사자 지원 단건 조회 성공" + ); + } catch (BadRequestException e) { + return ApiResponse.ok(210, "지원 내역이 없습니다."); + } } @Operation(summary = "지원자 통계 조회", description = "특정 모집글에 대한 지원자 통계를 조회합니다.")