-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
projects schema and router + adding to models #270
base: main
Are you sure you want to change the base?
Conversation
a9cb6ca
to
19a35aa
Compare
Solid first PR overall, thanks for getting this in so quick 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nits, but LGTM overall 👍 . Hold off on merging changes in until all projects functionality is completed, including the logic for joining a team, updating one's project, removing team members, etc. We can talk about those parts during the next meeting. Also, thanks for getting so much work done on the API--- if you ever need a break/have someone take over for your tasks lmk.
|
||
// find project associated with the ownerId | ||
const projectDetails = await Models.ProjectInfo.findOne({ ownerId: ownerId }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return a NoTeamFoundError if projectDetails is undefined. Even though that situation should never happen, we want to be comprehensive of all possible error cases.
// find project associated with the ownerId | ||
const projectDetails = await Models.ProjectInfo.findOne({ ownerId: ownerId }); | ||
|
||
return res.status(StatusCode.SuccessOK).send(projectDetails?.toObject()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove ?
...details, | ||
}; | ||
|
||
// ensure teamOwner hasn't already made a team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also check that the user isn't already mapped to a team in projectMappings.
} | ||
|
||
const newProject = await Models.ProjectInfo.create(project); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd probably also have logic for adding a projectMappings of the user to themselves, since they should be part of their own group.
Start of projects api