diff --git a/src/libs/middlewares/dimensions.js b/src/libs/middlewares/dimensions.js index 8532425cf107ee9f19b13009cdbbdc365e3ebbc3..618a510e028742dbbf4a8e9ca04d19d936d9e39e 100644 --- a/src/libs/middlewares/dimensions.js +++ b/src/libs/middlewares/dimensions.js @@ -12,6 +12,12 @@ * app.use(dimensions()) */ +/** + * This function returns the intersection of two arrays + * @param {array} a [description] + * @param {array} b [description] + * @return {array} [description] + */ function intersect(a, b) { let t; if (b.length > a.length) { diff --git a/src/libs/middlewares/query.js b/src/libs/middlewares/query.js index 7b0cc58682c4ed4bf8946dff8f1c25093b3b0a74..74a0c505cf02285dde3a35c0d0fc6365b8b4ce86 100644 --- a/src/libs/middlewares/query.js +++ b/src/libs/middlewares/query.js @@ -2,6 +2,12 @@ const libs = `${process.cwd()}/libs`; const log = require(`${libs}/log`)(module); const execQuery = require(`${libs}/db/query_exec`); +/** + * Middleware that executes a query defined by a squel object in req.sql + * @param {Object} req [description] + * @param {Object} res [description] + * @param {Function} next [description] + */ function query(req, res, next) { log.debug(req.sql); execQuery(req.sql.text, req.sql.values).then((result) => { diff --git a/src/libs/middlewares/response.js b/src/libs/middlewares/response.js index 09fa56566ec8444056fd3dbf3f8f0447eff9470a..83580825109c37c7da18e08d8c9c28b3e51487ea 100644 --- a/src/libs/middlewares/response.js +++ b/src/libs/middlewares/response.js @@ -2,6 +2,10 @@ const libs = `${process.cwd()}/libs`; const log = require(`${libs}/log`)(module); const xml = require('js2xmlparser'); +/** + * Custom generic middleware used to send api responses + * @param {string} value text to be used in the xml response + */ function response(value) { return (req, res, next) => { log.debug(req.query.format);