diff --git a/backend/lib/controllers/index.js b/backend/lib/controllers/index.js index e23f58248d..2972cbe7d7 100644 --- a/backend/lib/controllers/index.js +++ b/backend/lib/controllers/index.js @@ -2,12 +2,13 @@ const User = require('./user'); const Tag = require('./tag'); /** - * - * @param {Object} req - * @param {Object} res + * Basic api information controller + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const Api = (req, res) => { - res.status(200).json({ +const Api = (_request, response) => { + response.status(200).json({ name: 'Jiskefet Backend', version: '0.0.0', }); diff --git a/backend/lib/controllers/tag.js b/backend/lib/controllers/tag.js index 5d683b8b4f..80b87f598e 100644 --- a/backend/lib/controllers/tag.js +++ b/backend/lib/controllers/tag.js @@ -1,74 +1,82 @@ /** - * - * @param {Object} req - * @param {Object} res + * Create tag + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const create = (req, res) => { - res.send('TAG CREATE not defined'); -} +const create = (_request, response) => { + response.send('TAG CREATE not defined'); +}; /** - * - * @param {Object} req - * @param {Object} res + * Delete tag + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const deleteTag = (req, res) => { - res.send('TAG DELETE not defined'); -} +const deleteTag = (_request, response) => { + response.send('TAG DELETE not defined'); +}; /** - * - * @param {Object} req - * @param {Object} res + * Get all logs with tag + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const getLogs = (req, res) => { - res.send('TAG GET_LOGS not defined'); +const getLogs = (_request, response) => { + response.send('TAG GET_LOGS not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Get all Runs with tag + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const getRuns = (req, res) => { - res.send('TAG GET_RUNS not defined'); -} +const getRuns = (_request, response) => { + response.send('TAG GET_RUNS not defined'); +}; /** - * - * @param {Object} req - * @param {Object} res + * Get all tags + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const index = (req, res) => { - res.send('TAG INDEX not defined'); +const index = (_request, response) => { + response.send('TAG INDEX not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Patch tag on log + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const patchLog = (req, res) => { - res.send('TAG PATCH_LOG not defined'); +const patchLog = (_request, response) => { + response.send('TAG PATCH_LOG not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Patch tag on run + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const patchRun = (req, res) => { - res.send('TAG PATCH_RUN not defined'); +const patchRun = (_request, response) => { + response.send('TAG PATCH_RUN not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Get tag + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const read = (req, res) => { - res.send('TAG READ not defined'); -} +const read = (_request, response) => { + response.send('TAG READ not defined'); +}; module.exports = { create, @@ -79,4 +87,4 @@ module.exports = { patchLog, patchRun, read, -} +}; diff --git a/backend/lib/controllers/user.js b/backend/lib/controllers/user.js index f038e223bb..9bd7164573 100644 --- a/backend/lib/controllers/user.js +++ b/backend/lib/controllers/user.js @@ -1,46 +1,51 @@ /** - * - * @param {Object} req - * @param {Object} res + * Get all users + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const index = (req, res) => { - res.send('USER INDEX not defined'); +const index = (_request, response) => { + response.send('USER INDEX not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Get all logs of User + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const getLogs = (req, res) => { - res.send('USER GET_LOGS not defined'); +const getLogs = (_request, response) => { + response.send('USER GET_LOGS not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Get Tokens of user + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const getTokens = (req, res) => { - res.send('USER GET_TOKENS not defined'); +const getTokens = (_request, response) => { + response.send('USER GET_TOKENS not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Get user + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const read = (req, res) => { - res.send('USER READ not defined'); +const read = (_request, response) => { + response.send('USER READ not defined'); }; /** - * - * @param {Object} req - * @param {Object} res + * Post token for user + * @param {Object} _request response object + * @param {Object} response response object + * @returns {undefined} */ -const postTokens = (req, res) => { - res.send('USER POST_TOKENS not defined'); +const postTokens = (_request, response) => { + response.send('USER POST_TOKENS not defined'); }; module.exports = { diff --git a/backend/lib/routes/index.js b/backend/lib/routes/index.js index c5950df13c..c73d27247e 100644 --- a/backend/lib/routes/index.js +++ b/backend/lib/routes/index.js @@ -15,19 +15,21 @@ const routes = [ ]; /** - * - * @param {Object} parent - * @param {Object} child + * Makes the child object inherit the args of the parent object, but keeps the overwrites + * @param {Object} parent parent who's args will be inherited + * @param {Object} child child who will inherit the args + * @returns {undefined} */ const inheritArgs = (parent, child) => { child.args = deepmerge(parent.args||{}, child.args||{}); -} +}; /** * Route binder, used to bind routes to the httpServer * @param {Object} http httpServer that the routes should be bound on * @param {Object} route the route that should be bound - * @param {String} [path=''] the base path of the route + * @param {String} [parentPath=''] the base path of the route + * @returns {undefined} */ const bindRoute = (http, route, parentPath = '') => { const localPath = parentPath.concat(route.path); @@ -37,15 +39,15 @@ const bindRoute = (http, route, parentPath = '') => { } if (route.children) { - route.children.forEach(child => { + route.children.forEach((child) => { inheritArgs(route, child); bindRoute(http, child, localPath); }); } -} +}; module.exports = (http) => { - routes.forEach(route => { + routes.forEach((route) => { bindRoute(http, route); }); -} +};