backups: the get route was accidentally removed

This commit is contained in:
Girish Ramakrishnan
2025-07-25 11:49:13 +02:00
parent 3f07bb5c3a
commit 59aaabecc7
7 changed files with 30 additions and 18 deletions
+3 -6
View File
@@ -118,8 +118,8 @@ function validateLabel(label) {
}
// this is called by REST API
async function update(id, data) {
assert.strictEqual(typeof id, 'string');
async function update(backup, data) {
assert.strictEqual(typeof backup, 'object');
assert.strictEqual(typeof data, 'object');
let error;
@@ -135,10 +135,7 @@ async function update(id, data) {
values.push(data[p]);
}
}
values.push(id);
const backup = await get(id);
if (backup === null) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found');
values.push(backup.id);
const result = await database.query('UPDATE backups SET ' + fields.join(', ') + ' WHERE id = ?', values);
if (result.affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found');