Skip to content

Conversation

@rbessin
Copy link
Contributor

@rbessin rbessin commented Jan 25, 2026

Changes

BACKEND

  • added service method
  • added project controller method
  • added validation utility for copyMaterials parameters
  • added project route

FRONTEND

  • added url to copy materials
  • added api call
  • added hook method

Test Cases

  • Should the backend and frontend be tested before being used? If so, how should I proceed? Are there any tests I could look at as examples?

To Do

  • Add modal to call the hook.

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 # (issue #3886 )

@rbessin rbessin requested a review from wavehassman January 25, 2026 03:49
@rbessin rbessin self-assigned this Jan 25, 2026
Copy link
Contributor

@wavehassman wavehassman left a comment

Choose a reason for hiding this comment

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

Awesome job! For testing, you should use Postman to do manual testing for the route and look at backend project unit tests to see how to make unit tests for the service function

static async copyMaterialsToProject(req: Request, res: Response, next: NextFunction) {
try {
const { materialIds, destinationWbsNum } = req.body;
const destinationWBS = validateWBS(destinationWbsNum as string);
Copy link
Contributor

Choose a reason for hiding this comment

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

validate in the route

let newAssemblyId = null;

// Get or create assembly if needed
if (material.assemblyId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we do not want to copy over the assembly ID

const newMaterial = await tx.material.create({
data: {
name: material.name,
status: 'NOT_READY_TO_ORDER',
Copy link
Contributor

Choose a reason for hiding this comment

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

use the actual prisma status not the string

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