Skip to content

Commit

Permalink
Merge pull request #47 from StudyFlexUMC5th/yeeun2
Browse files Browse the repository at this point in the history
Fix: 메인페이지 api baseresponse적용
  • Loading branch information
Yeeun411 authored Jan 14, 2024
2 parents e170d8f + e2a87ac commit f4257ff
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/main/java/com/umc/StudyFlexBE/controller/StudyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,32 @@ public BaseResponse<?> participation(@PathVariable Long study_id){
}
}
@GetMapping("/latest")
public ResponseEntity<List<StudyMainPageResponseDto>> getLatestStudies() {
List<StudyMainPageResponseDto> latestStudies = studyService.getLatestStudies();
return ResponseEntity.ok(latestStudies);
public BaseResponse<?> getLatestStudies() {
try {
List<StudyMainPageResponseDto> latestStudies = studyService.getLatestStudies();
return new BaseResponse<>(BaseResponseStatus.SUCCESS, latestStudies);
}catch (BaseException e){
return new BaseResponse<>(e.getStatus());
}
}

@GetMapping("/open")
public ResponseEntity<List<StudyMainPageResponseDto>> getOpenStudies() {
List<StudyMainPageResponseDto> openStudies = studyService.getOpenStudies();
return ResponseEntity.ok(openStudies);
public BaseResponse<?> getOpenStudies() {
try {
List<StudyMainPageResponseDto> openStudies = studyService.getOpenStudies();
return new BaseResponse<>(BaseResponseStatus.SUCCESS, openStudies);
}catch (BaseException e){
return new BaseResponse<>(e.getStatus());
}
}
@GetMapping("/ranking")
public ResponseEntity<List<StudyMainPageResponseDto>> getStudyRanking() {
List<StudyMainPageResponseDto> rankedStudies = studyService.getRankedStudies();
return ResponseEntity.ok(rankedStudies);
public BaseResponse<?> getStudyRanking() {
try{
List<StudyMainPageResponseDto> rankedStudies = studyService.getRankedStudies();
return new BaseResponse<>(BaseResponseStatus.SUCCESS, rankedStudies);
}catch (BaseException e){
return new BaseResponse<>(e.getStatus());
}
}

@PostMapping("/{study_id}/postNotice")
Expand Down

0 comments on commit f4257ff

Please sign in to comment.