Skip to content

Commit

Permalink
Merge pull request #953 from OneCommunityGlobal/Imran_See_Users_in_Pr…
Browse files Browse the repository at this point in the history
…ojects

Imran added getProjectMembers permission
  • Loading branch information
one-community authored Jun 21, 2024
2 parents f9417ca + 5f73113 commit bfc861e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/controllers/projectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,22 @@ const projectController = function (Project) {
});
};

const getprojectMembership = function (req, res) {
const getprojectMembership = async function (req, res) {
const { projectId } = req.params;
if (!mongoose.Types.ObjectId.isValid(projectId)) {
res.status(400).send('Invalid request');
return;
}
const getId = await hasPermission(req.body.requestor, 'getProjectMembers');

userProfile
.find({ projects: projectId }, '_id firstName lastName isActive profilePic')
.find(
{ projects: projectId },
{ firstName: 1, lastName: 1, isActive: 1, profilePic: 1, _id: getId },
)
.sort({ firstName: 1, lastName: 1 })
.then((results) => {
console.log(results);
res.status(200).send(results);
})
.catch((error) => {
Expand Down

0 comments on commit bfc861e

Please sign in to comment.