diff --git a/backend-implicaction/src/main/java/com/dynonuggets/refonteimplicaction/community/profile/controller/ProfileController.java b/backend-implicaction/src/main/java/com/dynonuggets/refonteimplicaction/community/profile/controller/ProfileController.java index 38fdb1e3..80343ddb 100644 --- a/backend-implicaction/src/main/java/com/dynonuggets/refonteimplicaction/community/profile/controller/ProfileController.java +++ b/backend-implicaction/src/main/java/com/dynonuggets/refonteimplicaction/community/profile/controller/ProfileController.java @@ -5,6 +5,9 @@ import com.dynonuggets.refonteimplicaction.community.profile.service.ProfileService; import lombok.AllArgsConstructor; import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -14,7 +17,6 @@ import static com.dynonuggets.refonteimplicaction.community.profile.utils.ProfileUris.GET_PROFILE_BY_USERNAME; import static com.dynonuggets.refonteimplicaction.community.profile.utils.ProfileUris.PROFILES_BASE_URI; import static com.dynonuggets.refonteimplicaction.filemanagement.utils.FileUris.POST_PROFILE_AVATAR; -import static org.springframework.data.domain.PageRequest.of; @RestController @AllArgsConstructor @@ -26,9 +28,12 @@ public class ProfileController { @GetMapping public ResponseEntity> getAllProfiles( @RequestParam(defaultValue = "0") final int page, - @RequestParam(defaultValue = "10") final int rows + @RequestParam(defaultValue = "10") final int rows, + @RequestParam(value = "sortBy", defaultValue = "id") final String[] sortBy, + @RequestParam(value = "sortOrder", defaultValue = "ASC") final String sortOrder ) { - return ResponseEntity.ok(profileService.getAllProfiles(of(page, rows))); + final Pageable pageable = PageRequest.of(page, rows, Sort.by(Sort.Direction.valueOf(sortOrder), sortBy)); + return ResponseEntity.ok(profileService.getAllProfiles(pageable)); } @PutMapping diff --git a/frontend-implicaction/src/app/app.component.ts b/frontend-implicaction/src/app/app.component.ts index a67ebda1..7262def6 100644 --- a/frontend-implicaction/src/app/app.component.ts +++ b/frontend-implicaction/src/app/app.component.ts @@ -7,7 +7,7 @@ import {AuthService} from './core/services/auth.service'; import {take, takeUntil} from 'rxjs/operators'; import {ProfileContextService} from './core/services/profile-context.service'; import {Principal} from './shared/models/principal'; -import {Profile} from './community/models/profile/profile'; +import {Profile} from './community/models/profile'; import {ProfileService} from './community/services/profile/profile.service'; import {AppService} from './core/services/app.service'; import {AppStatusEnum} from './shared/enums/app-status-enum'; diff --git a/frontend-implicaction/src/app/community/components/community-sidemenu/community-sidemenu.component.html b/frontend-implicaction/src/app/community/components/community-sidemenu/community-sidemenu.component.html index 7c408705..ec803dfd 100644 --- a/frontend-implicaction/src/app/community/components/community-sidemenu/community-sidemenu.component.html +++ b/frontend-implicaction/src/app/community/components/community-sidemenu/community-sidemenu.component.html @@ -1,10 +1,11 @@ -