1771 - API for Fetching Project Managers #1799
1771 - API for Fetching Project Managers #1799ntrehan wants to merge 2 commits intohackforla:developmentfrom
Conversation
|
Want to review this pull request? Take a look at this documentation for a step by step guide! From your project repository, check out a new branch and test the changes. |
|
@ntrehan just a heads up that your API req & res screenshot is currently broken / doesn't populate. |
Hi @pluto-bell Thanks for pointing that out! |
| if (!userProjectMap[user]) { | ||
| userProjectMap[user] = []; | ||
| } | ||
| userProjectMap[user].push(project.name); |
|
If Note: it returns the test data because we're running it locally. It will the actual data for the production environment.
|
There was a problem hiding this comment.
Requesting clarification and changes on API
- will user object be populated for each entry?
- Can we switch to an array instead of an object so that the frontend doesnt need to duplicate data for users with more than one managed project?
Thanks for putting so much work into getting this over then hill!
|
|
||
| ProjectController.getProjectManagers = async function (req, res) { | ||
| try { | ||
| const userProjectMap = {}; |
There was a problem hiding this comment.
I think we want an array of objects of shape:
const userProjectMap = []; //changed to array// Object shape from API call
{
user, // will this just be the userId string or will
// we have a populated user object with email, etc?
project: {
name: string
projectId: string
}
}Does that look right to you? Then we'd be returning an array that can be sorted more easily on the front end with some sort functions
| userProjectMap[user].push(project.name); | ||
| } | ||
| } | ||
| return res.status(200).send(userProjectMap); |
There was a problem hiding this comment.
Am I right in understanding that the final out of the array (or object if thats the structure we go with) will only have user IDs? Do we need to make a second db call to populate the user object?
|
PR has been added to user_permissions_search feature branch! |

Fixes #1771
What changes did you make and why did you make them ?
Screenshots of Proposed Changes Of The Website
The API request and response
