diff --git a/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java b/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java index b93b912..97ca796 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java @@ -68,20 +68,32 @@ public BaseResponse participation(@PathVariable Long study_id){ } } @GetMapping("/latest") - public ResponseEntity> getLatestStudies() { - List latestStudies = studyService.getLatestStudies(); - return ResponseEntity.ok(latestStudies); + public BaseResponse getLatestStudies() { + try { + List latestStudies = studyService.getLatestStudies(); + return new BaseResponse<>(BaseResponseStatus.SUCCESS, latestStudies); + }catch (BaseException e){ + return new BaseResponse<>(e.getStatus()); + } } @GetMapping("/open") - public ResponseEntity> getOpenStudies() { - List openStudies = studyService.getOpenStudies(); - return ResponseEntity.ok(openStudies); + public BaseResponse getOpenStudies() { + try { + List openStudies = studyService.getOpenStudies(); + return new BaseResponse<>(BaseResponseStatus.SUCCESS, openStudies); + }catch (BaseException e){ + return new BaseResponse<>(e.getStatus()); + } } @GetMapping("/ranking") - public ResponseEntity> getStudyRanking() { - List rankedStudies = studyService.getRankedStudies(); - return ResponseEntity.ok(rankedStudies); + public BaseResponse getStudyRanking() { + try{ + List rankedStudies = studyService.getRankedStudies(); + return new BaseResponse<>(BaseResponseStatus.SUCCESS, rankedStudies); + }catch (BaseException e){ + return new BaseResponse<>(e.getStatus()); + } } @PostMapping("/{study_id}/postNotice")