diff --git a/src/server/endpoints/api/management/Roles.ts b/src/server/endpoints/api/management/Roles.ts index ec1bef9..da8a3b6 100644 --- a/src/server/endpoints/api/management/Roles.ts +++ b/src/server/endpoints/api/management/Roles.ts @@ -19,7 +19,6 @@ class Roles extends ApiEndpoint this.methods = [ [ 'get', this.getRoles.bind(this) ], [ 'post', this.createRole.bind(this), server.auth.createAuthoriser('administrator:roles:create') ], - ]; this.subpaths = [ @@ -35,11 +34,11 @@ class Roles extends ApiEndpoint async getRoles (req: Request, res: Response): Promise { const { query } = req; - const pageSize = query.amount ? parseInt(query.amount as string) : 10; + const pageSize = query.pageSize ? parseInt(query.pageSize as string) : 10; let page = query.page ? parseInt(query.page as string) - 1 : 0; if (query.page && isNaN(page)) return void res.status(400).send('Invalid page number'); - if (query.amount && isNaN(pageSize)) + if (query.pageSize && isNaN(pageSize)) return void res.status(400).send('Invalid amount'); const amts = await this.#users.count(); @@ -80,11 +79,11 @@ class Roles extends ApiEndpoint if (!role) return void res.status(404).end(); - const pageSize = query.amount ? parseInt(query.amount as string) : 10; + const pageSize = query.pageSize ? parseInt(query.pageSize as string) : 10; let page = query.page ? parseInt(query.page as string) - 1 : 0; if (query.page && isNaN(page)) return void res.status(400).send('Invalid page number'); - if (query.amount && isNaN(pageSize)) + if (query.pageSize && isNaN(pageSize)) return void res.status(400).send('Invalid amount'); const amt = await this.#users.countUsersWithRole(roleId);