Use concrete resource name instead of generic "resource"
This commit is contained in:
@@ -23,7 +23,7 @@ async function load(req, res, next) {
|
||||
const [error, result] = await safe(volumes.get(req.params.id));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
if (!result) return next(new HttpError(404, 'Volume not found'));
|
||||
req.resource = result;
|
||||
req.volume = result;
|
||||
next();
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ async function add(req, res, next) {
|
||||
async function get(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.id, 'string');
|
||||
|
||||
next(new HttpSuccess(200, volumes.removePrivateFields(req.resource)));
|
||||
next(new HttpSuccess(200, volumes.removePrivateFields(req.volume)));
|
||||
}
|
||||
|
||||
async function del(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.id, 'string');
|
||||
|
||||
const [error] = await safe(volumes.del(req.resource, auditSource.fromRequest(req)));
|
||||
const [error] = await safe(volumes.del(req.volume, auditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
next(new HttpSuccess(204));
|
||||
}
|
||||
@@ -69,7 +69,7 @@ async function list(req, res, next) {
|
||||
async function getStatus(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.id, 'string');
|
||||
|
||||
const [error, status] = await safe(volumes.getStatus(req.resource));
|
||||
const [error, status] = await safe(volumes.getStatus(req.volume));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
next(new HttpSuccess(200, status));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user