volume: remove private fields

This commit is contained in:
Girish Ramakrishnan
2021-06-21 16:35:08 -07:00
parent 6ace8d1ac5
commit 3ba2f96d51
3 changed files with 18 additions and 3 deletions
+5 -2
View File
@@ -45,7 +45,7 @@ async function add(req, res, next) {
async function get(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
next(new HttpSuccess(200, req.resource));
next(new HttpSuccess(200, volumes.removePrivateFields(req.resource)));
}
async function del(req, res, next) {
@@ -59,7 +59,10 @@ async function del(req, res, next) {
async function list(req, res, next) {
const [error, result] = await safe(volumes.list());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { volumes: result }));
const allVolumes = result.map(volumes.removePrivateFields);
next(new HttpSuccess(200, { volumes: allVolumes }));
}
async function getStatus(req, res, next) {