feat: Move get users API endpoint to admin namespace

This commit is contained in:
Faruk AYDIN
2024-02-24 00:31:15 +01:00
parent 72d68c4377
commit 532cfc10d0
6 changed files with 34 additions and 24 deletions

View File

@@ -0,0 +1,18 @@
import { renderObject } from '../../../../../helpers/renderer.js';
import User from '../../../../../models/user.js';
import paginateRest from '../../../../../helpers/pagination-rest.js';
export default async (request, response) => {
const usersQuery = User.query()
.leftJoinRelated({
role: true,
})
.withGraphFetched({
role: true,
})
.orderBy('full_name', 'asc');
const users = await paginateRest(usersQuery, request.query.page);
renderObject(response, users);
};