Skip to content

Commit

Permalink
added route for getting users by tenant company identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometheus7-creator committed Mar 10, 2024
1 parent 14953ea commit 21fb07c
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 21fb07c

Please sign in to comment.