Skip to content

Commit c04770b

Browse files
committed
refactor(volunteer-apply): 지원 내역이 없는 경우 210을 반환하도록 변경
1 parent 5ee22d2 commit c04770b

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/main/java/com/somemore/global/common/response/ApiResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public static <T> ApiResponse<T> ok(int status, T data, String message) {
1919
return new ApiResponse<>(status, message, data);
2020
}
2121

22+
public static ApiResponse<String> ok(int status, String message) {
23+
return new ApiResponse<>(status, message, "");
24+
}
25+
2226
public static ApiResponse<String> ok(String message) {
2327
return new ApiResponse<>(200, message, "");
2428
}

src/main/java/com/somemore/volunteerapply/controller/VolunteerApplyQueryApiController.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import static org.springframework.data.domain.Sort.Direction.DESC;
44

55
import com.somemore.auth.annotation.CurrentUser;
6+
import com.somemore.facade.volunteerapply.VolunteerApplyQueryFacadeUseCase;
67
import com.somemore.global.common.response.ApiResponse;
8+
import com.somemore.global.exception.BadRequestException;
79
import com.somemore.volunteerapply.domain.ApplyStatus;
810
import com.somemore.volunteerapply.dto.condition.VolunteerApplySearchCondition;
911
import com.somemore.volunteerapply.dto.response.VolunteerApplyRecruitInfoResponseDto;
10-
import com.somemore.volunteerapply.dto.response.VolunteerApplyResponseDto;
1112
import com.somemore.volunteerapply.dto.response.VolunteerApplySummaryResponseDto;
1213
import com.somemore.volunteerapply.dto.response.VolunteerApplyVolunteerInfoResponseDto;
13-
import com.somemore.facade.volunteerapply.VolunteerApplyQueryFacadeUseCase;
1414
import com.somemore.volunteerapply.usecase.VolunteerApplyQueryUseCase;
1515
import io.swagger.v3.oas.annotations.Operation;
1616
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -37,16 +37,20 @@ public class VolunteerApplyQueryApiController {
3737

3838
@Operation(summary = "특정 모집글 봉사자 지원 단건 조회", description = "특정 모집글에 대한 봉사자 지원을 조회합니다.")
3939
@GetMapping("/volunteer-apply/recruit-board/{recruitBoardId}/volunteer/{volunteerId}")
40-
public ApiResponse<VolunteerApplyResponseDto> getVolunteerApplyByRecruitIdAndVolunteerId(
40+
public ApiResponse<?> getVolunteerApplyByRecruitIdAndVolunteerId(
4141
@PathVariable Long recruitBoardId,
4242
@PathVariable UUID volunteerId
4343
) {
44-
return ApiResponse.ok(
45-
200,
46-
volunteerApplyQueryUseCase.getVolunteerApplyByRecruitIdAndVolunteerId(
47-
recruitBoardId, volunteerId),
48-
"특정 모집글에 대한 봉사자 지원 단건 조회 성공"
49-
);
44+
try {
45+
return ApiResponse.ok(
46+
200,
47+
volunteerApplyQueryUseCase.getVolunteerApplyByRecruitIdAndVolunteerId(
48+
recruitBoardId, volunteerId),
49+
"특정 모집글에 대한 봉사자 지원 단건 조회 성공"
50+
);
51+
} catch (BadRequestException e) {
52+
return ApiResponse.ok(210, "지원 내역이 없습니다.");
53+
}
5054
}
5155

5256
@Operation(summary = "지원자 통계 조회", description = "특정 모집글에 대한 지원자 통계를 조회합니다.")

0 commit comments

Comments
 (0)