From 2f457f2efdba2e4a5b90c5f7fea69c48a302fbc2 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sun, 14 Jan 2024 02:14:13 +0000 Subject: [PATCH] feat: Updated backend/src/routes/regionRoutes.js --- backend/src/routes/regionRoutes.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/regionRoutes.js b/backend/src/routes/regionRoutes.js index 14ae2c3..49da837 100644 --- a/backend/src/routes/regionRoutes.js +++ b/backend/src/routes/regionRoutes.js @@ -31,6 +31,13 @@ router.get( router.get( '/search', + /** + * Search regions based on query and hierarchy ID. + * + * @param {Object} req - The request object. + * @param {Object} res - The response object. + * @returns {Object} The response object. + */ [ query('query').isString().withMessage('Query must be a string'), query('hierarchyId').optional().isInt( @@ -49,6 +56,13 @@ router.get( router.get( '/:regionId', + /** + * Get region by ID. + * + * @param {Object} req - The request object. + * @param {Object} res - The response object. + * @returns {Object} The response object. + */ ...[ check('regionId').isInt( { min: 0, max: getDataTypeRange(Region, 'id').max }, @@ -86,7 +100,6 @@ router.get( return regionController.getSubregions(req, res); }, ); - router.get( '/:regionId/ancestors', ...[