Use concrete resource name instead of generic "resource"

This commit is contained in:
Girish Ramakrishnan
2021-09-20 22:39:35 -07:00
parent d1e8fded65
commit 0cfc3e03bb
4 changed files with 85 additions and 85 deletions
+4 -4
View File
@@ -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));
}