rename function to listByTypePaged
This commit is contained in:
+13
-13
@@ -4,12 +4,12 @@ exports = module.exports = {
|
||||
get,
|
||||
getByIdentifierAndStatePaged,
|
||||
getLatestInTargetByIdentifier, // brutal function name
|
||||
getByTypePaged,
|
||||
add,
|
||||
update,
|
||||
setState,
|
||||
list,
|
||||
listBySiteId,
|
||||
listByTypePaged,
|
||||
del,
|
||||
|
||||
removePrivateFields,
|
||||
@@ -125,18 +125,6 @@ async function get(id) {
|
||||
return postProcess(result[0]);
|
||||
}
|
||||
|
||||
async function getByTypePaged(type, page, perPage) {
|
||||
assert.strictEqual(typeof type, 'string');
|
||||
assert(typeof page === 'number' && page > 0);
|
||||
assert(typeof perPage === 'number' && perPage > 0);
|
||||
|
||||
const results = await database.query(`SELECT ${BACKUPS_FIELDS} FROM backups WHERE type = ? ORDER BY creationTime DESC LIMIT ?,?`, [ type, (page-1)*perPage, perPage ]);
|
||||
|
||||
results.forEach(function (result) { postProcess(result); });
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function validateLabel(label) {
|
||||
assert.strictEqual(typeof label, 'string');
|
||||
|
||||
@@ -196,6 +184,18 @@ async function list(page, perPage) {
|
||||
return results;
|
||||
}
|
||||
|
||||
async function listByTypePaged(type, page, perPage) {
|
||||
assert.strictEqual(typeof type, 'string');
|
||||
assert(typeof page === 'number' && page > 0);
|
||||
assert(typeof perPage === 'number' && perPage > 0);
|
||||
|
||||
const results = await database.query(`SELECT ${BACKUPS_FIELDS} FROM backups WHERE type = ? ORDER BY creationTime DESC LIMIT ?,?`, [ type, (page-1)*perPage, perPage ]);
|
||||
|
||||
results.forEach(function (result) { postProcess(result); });
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
async function listBySiteId(siteId, page, perPage) {
|
||||
assert.strictEqual(typeof siteId, 'string');
|
||||
assert(typeof page === 'number' && page > 0);
|
||||
|
||||
Reference in New Issue
Block a user