Rename getByIdentifierAndStatePaged to listByIdentifierAndStatePaged

This commit is contained in:
Girish Ramakrishnan
2026-02-15 12:15:55 +01:00
parent eae86d15ef
commit fc2e39f41b
6 changed files with 22 additions and 22 deletions
+14 -14
View File
@@ -76,19 +76,6 @@ async function add(data) {
return id;
}
async function getByIdentifierAndStatePaged(identifier, state, page, perPage) {
assert.strictEqual(typeof identifier, 'string');
assert.strictEqual(typeof state, 'string');
assert(typeof page === 'number' && page > 0);
assert(typeof perPage === 'number' && perPage > 0);
const results = await database.query(`SELECT ${BACKUPS_FIELDS} FROM backups WHERE identifier = ? AND state = ? ORDER BY creationTime DESC LIMIT ?,?`, [ identifier, state, (page-1)*perPage, perPage ]);
results.forEach(postProcess);
return results;
}
async function getLatestInTargetByIdentifier(identifier, siteId) {
assert.strictEqual(typeof identifier, 'string');
assert.strictEqual(typeof siteId, 'string');
@@ -163,6 +150,19 @@ async function listByTypePaged(type, siteId, page, perPage) {
return results;
}
async function listByIdentifierAndStatePaged(identifier, state, page, perPage) {
assert.strictEqual(typeof identifier, 'string');
assert.strictEqual(typeof state, 'string');
assert(typeof page === 'number' && page > 0);
assert(typeof perPage === 'number' && perPage > 0);
const results = await database.query(`SELECT ${BACKUPS_FIELDS} FROM backups WHERE identifier = ? AND state = ? ORDER BY creationTime DESC LIMIT ?,?`, [ identifier, state, (page-1)*perPage, perPage ]);
results.forEach(postProcess);
return results;
}
async function del(id) {
assert.strictEqual(typeof id, 'string');
@@ -230,7 +230,7 @@ async function clearTasks() {
export default {
get,
getByIdentifierAndStatePaged,
listByIdentifierAndStatePaged,
getLatestInTargetByIdentifier, // brutal function name
add,
update,