Skip to content

Commit

Permalink
Merge pull request #55 from Likelion12/19-be-크루-조회
Browse files Browse the repository at this point in the history
Feat : 크루 조회
  • Loading branch information
jsilver01 authored Aug 5, 2024
2 parents 6a99452 + b3fc56e commit ae39c30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public BaseResponse<PostCrewResponse> createCrew(@RequestHeader("Authorization")
*/
@GetMapping("/inquiry")
public BaseResponse<List<GetCrewInquiryResponse>> getCrewInquiries(@RequestHeader("Authorization") String authorization,
@RequestParam List<Long> crewId){
@RequestParam int page){
log.info("[CrewController.getCrewInquiries]");
Long memberId = jwtProvider.extractIdFromHeader(authorization);
return new BaseResponse<>(crewService.getCrewInquiries(memberId, crewId));
return new BaseResponse<>(crewService.getCrewInquiries(memberId,page));
}


Expand Down
14 changes: 9 additions & 5 deletions src/main/java/com/example/likelion12/service/CrewService.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ public PostCrewResponse createCrew(Long memberId, PostCrewRequest postCrewReques
/**
* 크루 조회
*/
public List<GetCrewInquiryResponse> getCrewInquiries(Long memberId, List<Long> crewIds) {
public List<GetCrewInquiryResponse> getCrewInquiries(Long memberId, int page) {
log.info("[CrewService.getCrewInquiries]");

List<Crew> allCrews = crewRepository.findAllByStatus(BaseStatus.ACTIVE);
List<GetCrewInquiryResponse> getCrewInquiryResponses = new ArrayList<>();

for (Long crewId : crewIds) {
// offset과 limit 계산
int offset = (page - 1) * 9;
int recordSize = 9 ;

// 페이징 처리된 크루 목록 생성
for (int i = offset; i < Math.min(offset + recordSize, allCrews.size()); i++) {

//조회하고자 하는 크루
Crew crew = crewRepository.findByCrewIdAndStatus(crewId, BaseStatus.ACTIVE)
.orElseThrow(() -> new CrewException(CANNOT_FOUND_CREW));
Crew crew = allCrews.get(i);

GetCrewInquiryResponse response = new GetCrewInquiryResponse(
crew.getCrewName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public List<GetSocialringJoinStatusResponse> joinCompleteSocialring(Long memberI

return responseList;
}

/**
* 소셜링 검색결과 필터링
*/
Expand Down

0 comments on commit ae39c30

Please sign in to comment.