fix(backend): fix username sorter, add roles sorter for staff

This commit is contained in:
MiniDigger | Martin 2022-11-20 10:58:28 +01:00
parent 1396a1f019
commit 5319a2d6a0
2 changed files with 3 additions and 2 deletions

View File

@ -63,7 +63,7 @@ public class UsersController extends HangarComponent implements IUsersController
}
@Override
@ApplicableSorters({SorterRegistry.USER_NAME, SorterRegistry.USER_JOIN_DATE})
@ApplicableSorters({SorterRegistry.USER_NAME, SorterRegistry.USER_JOIN_DATE, SorterRegistry.USER_ROLES})
public ResponseEntity<PaginatedResult<User>> getStaff(@NotNull RequestPagination pagination) {
return ResponseEntity.ok(usersApiService.getStaff(pagination));
}

View File

@ -8,8 +8,9 @@ import java.util.Map;
public enum SorterRegistry implements Sorter {
USER_JOIN_DATE("joinDate", simpleSorter("u.join_date")),
USER_NAME("username", simpleSorter("lower(username)")),
USER_NAME("name", simpleSorter("lower(u.name)")),
USER_PROJECT_COUNT("projectCount", simpleSorter("project_count")),
USER_ROLES("roles", simpleSorter("roles")),
// For Projects
VIEWS("views", simpleSorter("hp.views")),