Skip to content

Commit 245138e

Browse files
authored
Feat : 파티 조회 페이지네이션 주석처리 (#134)
1 parent 0d31291 commit 245138e

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

src/main/java/ita/tinybite/domain/party/service/PartyService.java

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ public PartyListResponse getPartyList(Long userId, PartyListRequest request) {
140140
user = userRepository.findById(userId).orElse(null);
141141
}
142142

143+
// TODO: 페이지네이션 임시 비활성화 - 추후 복구 필요
143144
// 페이지네이션 파라미터 (기본값: page=0, size=20)
144-
int page = request.getPage() != null ? request.getPage() : 0;
145-
int size = request.getSize() != null ? request.getSize() : 20;
145+
// int page = request.getPage() != null ? request.getPage() : 0;
146+
// int size = request.getSize() != null ? request.getSize() : 20;
146147

147148
String myTown = getMyTown(request.getUserLat(),request.getUserLon());
148149

@@ -172,45 +173,46 @@ public PartyListResponse getPartyList(Long userId, PartyListRequest request) {
172173
List<PartyCardResponse> activeParties = cardResponses.stream()
173174
.filter(p -> !p.getIsClosed())
174175
.sorted(getComparator(request.getSortType()))
175-
.toList();
176+
.collect(Collectors.toList());
176177

177178
// 마감된 파티 정렬
178179
List<PartyCardResponse> closedParties = cardResponses.stream()
179180
.filter(PartyCardResponse::getIsClosed)
180181
.sorted(getComparator(request.getSortType()))
181-
.toList();
182+
.collect(Collectors.toList());
182183

184+
// TODO: 페이지네이션 임시 비활성화 - 추후 복구 필요
183185
// 진행 중 + 마감된 파티 합치기 (진행 중이 먼저)
184-
List<PartyCardResponse> allParties = new ArrayList<>();
185-
allParties.addAll(activeParties);
186-
allParties.addAll(closedParties);
186+
// List<PartyCardResponse> allParties = new ArrayList<>();
187+
// allParties.addAll(activeParties);
188+
// allParties.addAll(closedParties);
187189

188190
// 페이지네이션 적용
189-
int startIndex = page * size;
190-
int endIndex = Math.min(startIndex + size, allParties.size());
191+
// int startIndex = page * size;
192+
// int endIndex = Math.min(startIndex + size, allParties.size());
191193

192-
List<PartyCardResponse> paginatedParties = allParties.subList(
193-
Math.min(startIndex, allParties.size()),
194-
endIndex
195-
);
194+
// List<PartyCardResponse> paginatedParties = allParties.subList(
195+
// Math.min(startIndex, allParties.size()),
196+
// endIndex
197+
// );
196198

197199
// hasNext 계산
198-
boolean hasNext = endIndex < allParties.size();
200+
// boolean hasNext = endIndex < allParties.size();
199201

200202
// 페이지네이션된 결과를 다시 진행 중/마감으로 분리
201-
List<PartyCardResponse> paginatedActiveParties = paginatedParties.stream()
202-
.filter(p -> !p.getIsClosed())
203-
.collect(Collectors.toList());
203+
// List<PartyCardResponse> paginatedActiveParties = paginatedParties.stream()
204+
// .filter(p -> !p.getIsClosed())
205+
// .collect(Collectors.toList());
204206

205-
List<PartyCardResponse> paginatedClosedParties = paginatedParties.stream()
206-
.filter(PartyCardResponse::getIsClosed)
207-
.collect(Collectors.toList());
207+
// List<PartyCardResponse> paginatedClosedParties = paginatedParties.stream()
208+
// .filter(PartyCardResponse::getIsClosed)
209+
// .collect(Collectors.toList());
208210

209211
return PartyListResponse.builder()
210-
.activeParties(paginatedActiveParties)
211-
.closedParties(paginatedClosedParties)
212-
.totalCount(allParties.size())
213-
.hasNext(hasNext)
212+
.activeParties(activeParties)
213+
.closedParties(closedParties)
214+
.totalCount(activeParties.size() + closedParties.size())
215+
.hasNext(false)
214216
.build();
215217
}
216218

0 commit comments

Comments
 (0)