make auditsource a class
this allows us to use AuditSource for the class and auditSource for the instances!
This commit is contained in:
@@ -6,7 +6,7 @@ exports = module.exports = {
|
||||
cleanup,
|
||||
};
|
||||
|
||||
const auditSource = require('../auditsource.js'),
|
||||
const AuditSource = require('../auditsource.js'),
|
||||
backups = require('../backups.js'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
@@ -27,14 +27,14 @@ async function list(req, res, next) {
|
||||
}
|
||||
|
||||
async function startBackup(req, res, next) {
|
||||
const [error, taskId] = await safe(backups.startBackupTask(auditSource.fromRequest(req)));
|
||||
const [error, taskId] = await safe(backups.startBackupTask(AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(202, { taskId }));
|
||||
}
|
||||
|
||||
async function cleanup(req, res, next) {
|
||||
const [error, taskId] = await safe(backups.startCleanupTask(auditSource.fromRequest(req)));
|
||||
const [error, taskId] = await safe(backups.startCleanupTask(AuditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(202, { taskId }));
|
||||
|
||||
Reference in New Issue
Block a user