Skip to content

Commit 0e8aaaf

Browse files
milowonmarshmallowing
authored andcommitted
fix : 마이페이지에서 참여중, 호스트 파티 조회시 최신순으로 조회되도록 수정 (#98)
1 parent b53f7b4 commit 0e8aaaf

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/main/java/ita/tinybite/domain/user/controller/UserController.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,6 @@ public ResponseEntity<List<PartyCardResponse>> getParticipatingParties(
158158
return ResponseEntity.ok(response);
159159
}
160160

161-
// @Operation(summary = "활성 파티 목록 조회", description = "사용자가 참여 중인 활성 파티 목록을 조회합니다.")
162-
// @ApiResponses({
163-
// @ApiResponse(responseCode = "200", description = "조회 성공",
164-
// content = @Content(array = @ArraySchema(schema = @Schema(implementation = PartyCardResponse.class)))),
165-
// @ApiResponse(responseCode = "401", description = "인증 실패")
166-
// })
167-
// @GetMapping("/parties/active")
168-
// public ResponseEntity<List<PartyCardResponse>> getActiveParties(
169-
// @AuthenticationPrincipal Long userId) {
170-
// List<PartyCardResponse> response = userService.getActiveParties(userId);
171-
// return ResponseEntity.ok(response);
172-
// }
173-
174161
@Operation(summary = "닉네임 중복 확인", description = "닉네임 사용 가능 여부를 확인합니다.")
175162
@ApiResponses({
176163
@ApiResponse(responseCode = "200", description = "사용 가능한 닉네임"),

src/main/java/ita/tinybite/domain/user/service/UserService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.time.LocalDateTime;
2828
import java.util.Arrays;
29+
import java.util.Comparator;
2930
import java.util.List;
3031
import java.util.Optional;
3132
import java.util.stream.Collectors;
@@ -181,6 +182,7 @@ public List<PartyCardResponse> getHostingParties(Long userId) {
181182
);
182183

183184
return parties.stream()
185+
.sorted(Comparator.comparing(Party::getCreatedAt).reversed())
184186
.map(party -> {
185187
int currentParticipants = participantRepository
186188
.countByPartyIdAndStatus(party.getId(), ParticipantStatus.APPROVED);
@@ -198,6 +200,8 @@ public List<PartyCardResponse> getParticipatingParties(Long userId) {
198200
);
199201

200202
return participants.stream()
203+
.sorted(Comparator.comparing(pp -> pp.getParty().getCreatedAt(),
204+
Comparator.reverseOrder()))
201205
.map(pp -> {
202206
Party party = pp.getParty();
203207
int currentParticipants = participantRepository

0 commit comments

Comments
 (0)