Skip to content

Commit

Permalink
[Feat] : 스터디 참여 신청 정보 조회 jwt포함한 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
wellbeing-dough committed Mar 3, 2024
1 parent 9887e33 commit ec6ffe1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ public FindApplyResponse findStudyEnroll(@RequestParam Long studyId, @RequestPar
return applyService.findApply(new FindApplyRequest(studyId, inspection), page, size);
}

@Operation(summary = "스터디 참여 신청 정보 조회 jwt포함", description = "해당 스터디 Id, 신청 정보를 파라미터로 보내주세요.")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "페이지", required = true),
@ApiImplicitParam(name = "size", value = "사이즈", required = true),
@ApiImplicitParam(name = "studyId", value = "스터디 식별자", required = true),
@ApiImplicitParam(name = "inspection", value = "상태", required = true)
})
@GetMapping("/v3/study")
public FindApplyResponse findStudyEnrollV2(UserId userId, @RequestParam Long studyId, @RequestParam Inspection inspection, @RequestParam int page, @RequestParam int size) {
return applyService.findApplyV2(userId.getId(), new FindApplyRequest(studyId, inspection), page, size);
}

@Operation(summary = "스터디 참여 신청 정보 조회(거절)", description = "해당 스터디 id를 보내주세요.")
@GetMapping("/v1/study-reject")
public FindRejectApplyResponse findRejectApply(UserId userId, @RequestParam Long studyId, @RequestParam int page, @RequestParam int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ public FindApplyResponse findApply(FindApplyRequest request, final int page, fin
return new FindApplyResponse((long) size, userData);
}

public FindApplyResponse findApplyV2(Long userId, FindApplyRequest request, int page, int size) {
UserEntity user = userRepository.findById(userId).orElseThrow(UserNotFoundException::new);
StudyEntity study = studyRepository.findById(request.getStudyId()).orElseThrow(StudyNotFoundException::new);
validIsMasterUserOfStudy(user, study);
Pageable pageable = PageRequest.of(page, size);
Slice<ApplyUserData> userData = Converter.toSlice(pageable, applyRepository.findStudyByIdAndInspection(request, pageable));
return new FindApplyResponse((long) size, userData);
}

public FindRejectApplyResponse findRejectApply(Long userId, Long studyId, int page, int size) {
UserEntity user = userRepository.findById(userId).orElseThrow(UserNotFoundException::new);
StudyEntity study = studyRepository.findById(studyId).orElseThrow(StudyNotFoundException::new);
Expand Down

0 comments on commit ec6ffe1

Please sign in to comment.