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 = "특정 모집글에 대한 지원자 통계를 조회합니다.")