|
8 | 8 | import com.example.solidconnection.siteuser.domain.SiteUser; |
9 | 9 | import lombok.RequiredArgsConstructor; |
10 | 10 | import org.springframework.data.domain.Pageable; |
| 11 | +import org.springframework.data.domain.Sort; |
11 | 12 | import org.springframework.data.web.PageableDefault; |
| 13 | +import org.springframework.data.web.SortDefault; |
| 14 | +import org.springframework.data.web.SortDefault.SortDefaults; |
12 | 15 | import org.springframework.http.ResponseEntity; |
13 | 16 | import org.springframework.web.bind.annotation.GetMapping; |
14 | 17 | import org.springframework.web.bind.annotation.PathVariable; |
@@ -38,7 +41,13 @@ public ResponseEntity<MentorDetailResponse> getMentorDetails( |
38 | 41 | public ResponseEntity<SliceResponse<MentorPreviewResponse>> getMentorPreviews( |
39 | 42 | @AuthorizedUser SiteUser siteUser, |
40 | 43 | @RequestParam("region") String region, |
41 | | - @PageableDefault(size = 3, sort = "menteeCount", direction = DESC) Pageable pageable |
| 44 | + |
| 45 | + @PageableDefault(size = 3, sort = "menteeCount", direction = DESC) |
| 46 | + @SortDefaults({ |
| 47 | + @SortDefault(sort = "menteeCount", direction = Sort.Direction.DESC), |
| 48 | + @SortDefault(sort = "id", direction = Sort.Direction.ASC) |
| 49 | + }) |
| 50 | + Pageable pageable |
42 | 51 | ) { |
43 | 52 | SliceResponse<MentorPreviewResponse> response = mentorQueryService.getMentorPreviews(region, siteUser, pageable); |
44 | 53 | return ResponseEntity.ok(response); |
|
0 commit comments