From 21fb07cf7b1a3d2ff98cdf1a70a5a5d8d1a0bef9 Mon Sep 17 00:00:00 2001 From: Ansh Grover Date: Sun, 10 Mar 2024 18:29:28 +0530 Subject: [PATCH] added route for getting users by tenant company identifier --- routes/user-endpoint.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/routes/user-endpoint.js b/routes/user-endpoint.js index 872096e..ca04cea 100644 --- a/routes/user-endpoint.js +++ b/routes/user-endpoint.js @@ -309,6 +309,30 @@ catch(exception){ res.status(500).send(`Intenal server error.${exception}"`); } }); + +router.route('/allusersbytenant') +.get(async function(req,res){ + +try{ + var companyIdentifier = req.query.company; + users.getAllUser(function(err,result){ + if(err){ + res.status(err.status).send(err.message); + } + else{ + console.debug(result); + result.users = result.users.filter(user => user.companyIdentifier && user.companyIdentifier === companyIdentifier); + res.status(result.status).json(result.users); + } + }); +} +catch(exception){ + res.status(500).send(`Intenal server error.${exception}"`); +} +}); + + + //#endregion router.route('/:username') .get(async function(req,res){