Skip to content

Conversation

@gcooper407
Copy link
Contributor

@gcooper407 gcooper407 commented Mar 26, 2025

Changes

Created getAllParts endpoints that retrieves all the parts for a specified project, so that the parts can be displayed on the Parts Review page. The information that the endpoint returns includes information about tags, project, assignees, and reviewe requests, but not submissions or reviews.

GET /parts/:wbsNum

Test Cases

  • getting all parts from a project with no parts successfully returns empty array
  • getting all parts for the correct project (two different created projects)

Screenshots

Screenshot 2025-03-26 at 7 54 04 PM Screenshot 2025-03-26 at 7 55 18 PM Screenshot 2025-03-26 at 7 55 49 PM

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #3157

@gcooper407 gcooper407 requested review from Zwendle and chpy04 March 26, 2025 23:56
@gcooper407 gcooper407 self-assigned this Mar 26, 2025
@gcooper407 gcooper407 changed the base branch from feature/stats-page to feature/cad-project-file-review March 26, 2025 23:57
Copy link
Contributor

@chpy04 chpy04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just move some stuff around and maybe rename the endpoint to more accurately describe what it is

try {
const wbsNumber: WbsNumber = validateWBS(req.params.wbsNum);

const project: Project = await ProjectsService.getSingleProject(wbsNumber, req.organization);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we typically put this logic inside of the service function, the controller should typically only call one service function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool that was something I was wondering, good to know, easy fix

* @param organizationId organization Id of the Project
* @returns all the parts from the given project
*/
static async getAllParts(projectId: string, organizationId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesnt quite fit for a getAllParts endpoint, Id call it a getPartsForProject, or it should probably take in the wbsNum and then get a project for that and then find the part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do the latter, do you still want the name change?

Copy link
Contributor Author

@gcooper407 gcooper407 Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but yeah during the process I realized that for our use case, we want to get parts for a specific project (as opposed to an entire org) so I just adjusted it to that and didn't reconsider the name -- I do agree about making the name more specific

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah name change should be good

import { validateWBS, WbsNumber } from 'shared';

export default class PartReviewController {
static async getAllParts(req: Request, res: Response, next: NextFunction) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also rename this please

@gcooper407 gcooper407 requested a review from walker-sean April 1, 2025 05:46
@walker-sean walker-sean merged commit d11f4ee into feature/cad-project-file-review Apr 2, 2025
4 checks passed
@walker-sean walker-sean deleted the 3157-get-all-parts-endpoint branch April 2, 2025 00:46
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.

5 participants