make auditsource a class

this allows us to use AuditSource for the class and auditSource for
the instances!
This commit is contained in:
Girish Ramakrishnan
2021-09-30 09:50:30 -07:00
parent 339fdfbea1
commit 445c83c8b9
22 changed files with 138 additions and 131 deletions

View File

@@ -9,7 +9,7 @@ exports = module.exports = {
};
const assert = require('assert'),
auditSource = require('../auditsource.js'),
AuditSource = require('../auditsource.js'),
BoxError = require('../boxerror.js'),
debug = require('debug')('box:routes/mailserver'),
HttpError = require('connect-lastmile').HttpError,
@@ -68,7 +68,7 @@ async function setLocation(req, res, next) {
if (typeof req.body.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
if (typeof req.body.subdomain !== 'string') return next(new HttpError(400, 'subdomain must be a string'));
const [error, taskId] = await safe(mail.setLocation(req.body.subdomain, req.body.domain, auditSource.fromRequest(req)));
const [error, taskId] = await safe(mail.setLocation(req.body.subdomain, req.body.domain, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, { taskId }));