Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Bahl-Aryan
Copy link

Start of projects api

src/app.ts Outdated Show resolved Hide resolved
src/app.ts Outdated Show resolved Hide resolved
src/common/models.ts Outdated Show resolved Hide resolved
src/common/models.ts Outdated Show resolved Hide resolved
src/common/models.ts Outdated Show resolved Hide resolved
src/services/projects/projects-router.ts Outdated Show resolved Hide resolved
src/services/projects/projects-schema.ts Outdated Show resolved Hide resolved
src/services/projects/projects-schema.ts Outdated Show resolved Hide resolved
src/services/projects/projects-schema.ts Outdated Show resolved Hide resolved
src/services/projects/projects-schema.ts Outdated Show resolved Hide resolved
@aletya
Copy link
Contributor

aletya commented Oct 31, 2024

Solid first PR overall, thanks for getting this in so quick 👍

Copy link
Contributor

@aletya aletya left a 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.

src/common/models.ts Show resolved Hide resolved
src/common/models.ts Show resolved Hide resolved
src/services/project/project-router.ts Show resolved Hide resolved
src/services/project/project-router.ts Show resolved Hide resolved

// find project associated with the ownerId
const projectDetails = await Models.ProjectInfo.findOne({ ownerId: ownerId });

Copy link
Contributor

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.

src/services/project/project-router.ts Show resolved Hide resolved
// find project associated with the ownerId
const projectDetails = await Models.ProjectInfo.findOne({ ownerId: ownerId });

return res.status(StatusCode.SuccessOK).send(projectDetails?.toObject());
Copy link
Contributor

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
Copy link
Contributor

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);

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants