Add user pagination to rest api
This commit is contained in:
17
src/users.js
17
src/users.js
@@ -6,7 +6,8 @@ exports = module.exports = {
|
||||
removePrivateFields: removePrivateFields,
|
||||
removeRestrictedFields: removeRestrictedFields,
|
||||
|
||||
list: list,
|
||||
getAll: getAll,
|
||||
getAllPaged: getAllPaged,
|
||||
create: create,
|
||||
isActivated: isActivated,
|
||||
verify: verify,
|
||||
@@ -304,7 +305,7 @@ function removeUser(userId, auditSource, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function list(callback) {
|
||||
function getAll(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
userdb.getAllWithGroupIds(function (error, results) {
|
||||
@@ -314,6 +315,18 @@ function list(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function getAllPaged(page, perPage, callback) {
|
||||
assert.strictEqual(typeof page, 'number');
|
||||
assert.strictEqual(typeof perPage, 'number');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
userdb.getAllWithGroupIdsPaged(page, perPage, function (error, results) {
|
||||
if (error) return callback(new UsersError(UsersError.INTERNAL_ERROR, error));
|
||||
|
||||
return callback(null, results);
|
||||
});
|
||||
}
|
||||
|
||||
function count(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user