Skip to content

Commit

Permalink
Merge pull request #112 from Prometheus7-creator/multitenant
Browse files Browse the repository at this point in the history
added route for getting users by tenant company identifier
  • Loading branch information
abhinovpankaj authored Mar 10, 2024
2 parents 14953ea + 21fb07c commit bda064b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions routes/user-endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit bda064b

Please sign in to comment.