diff --git a/lib/api/storage.js b/lib/api/storage.js index 16ace7e5..a704fde6 100644 --- a/lib/api/storage.js +++ b/lib/api/storage.js @@ -309,15 +309,39 @@ module.exports = (db, server, storageHandler) => { ); server.del( - '/users/:user/storage/:file', + { + path: '/users/:user/storage/:file', + tags: ['Storage'], + summary: 'Delete a File', + validationObjs: { + requestBody: {}, + queryParams: { + sess: sessSchema, + ip: sessIPSchema + }, + pathParams: { + user: userId, + file: Joi.string().hex().lowercase().length(24).required().description('ID of the File') + }, + response: { + 200: { + description: 'Success', + model: Joi.object({ + success: successRes + }) + } + } + } + }, tools.responseWrapper(async (req, res) => { res.charSet('utf-8'); - const schema = Joi.object().keys({ - user: Joi.string().hex().lowercase().length(24).required(), - file: Joi.string().hex().lowercase().length(24).required(), - sess: sessSchema, - ip: sessIPSchema + const { requestBody, queryParams, pathParams } = req.route.spec.validationObjs; + + const schema = Joi.object({ + ...requestBody, + ...queryParams, + ...pathParams }); const result = schema.validate(req.params, {