volumes: update route
This commit is contained in:
@@ -6,7 +6,7 @@ exports = module.exports = {
|
||||
del,
|
||||
list,
|
||||
load,
|
||||
setMountConfig,
|
||||
update,
|
||||
getMountStatus
|
||||
};
|
||||
|
||||
@@ -61,13 +61,13 @@ async function list(req, res, next) {
|
||||
next(new HttpSuccess(200, { volumes: result }));
|
||||
}
|
||||
|
||||
async function setMountConfig(req, res, next) {
|
||||
async function update(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.id, 'string');
|
||||
|
||||
if (typeof req.body.mountType !== 'string') return next(new HttpError(400, 'mountType must be a string'));
|
||||
if (typeof req.body.mountOptions !== 'object') return next(new HttpError(400, 'mountOptions must be a object'));
|
||||
|
||||
const [error] = await safe(volumes.setMountConfig(req.resource, req.body.mountType, req.body.mountOptions));
|
||||
const [error] = await safe(volumes.update(req.resource, req.body.mountType, req.body.mountOptions));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user