rename to listByTypePaged

This commit is contained in:
Girish Ramakrishnan
2018-12-11 16:10:38 -08:00
parent e0c9658cb9
commit fa483e5806
3 changed files with 9 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
exports = module.exports = {
get: get,
update: update,
listPaged: listPaged,
listByTypePaged: listByTypePaged,
getLogs: getLogs,
@@ -17,6 +17,7 @@ exports = module.exports = {
TASK_UPDATE: 'update',
TASK_MIGRATE: 'migrate',
TASK_RENEW_CERTS: 'renewcerts',
TASK_RESTORE: 'restore',
// testing
_TASK_IDENTITY: '_identity',
@@ -152,15 +153,17 @@ function stopTask(id, callback) {
callback(null);
}
function listPaged(type, page, perPage, callback) {
function listByTypePaged(type, page, perPage, callback) {
assert(typeof type === 'string' || type === null);
assert.strictEqual(typeof page, 'number');
assert.strictEqual(typeof perPage, 'number');
assert.strictEqual(typeof callback, 'function');
taskdb.listPaged(type, page, perPage, function (error, tasks) {
taskdb.listByTypePaged(type, page, perPage, function (error, tasks) {
if (error) return callback(new TaskError(TaskError.INTERNAL_ERROR, error));
tasks.forEach((task) => { task.active = !!gTasks[task.id]; });
callback(null, tasks);
});
}