Skip to content

Commit ffe78cf

Browse files
committed
#1330 - get seed data working
1 parent ed7c26b commit ffe78cf

1 file changed

Lines changed: 48 additions & 34 deletions

File tree

src/backend/src/prisma/seed.ts

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -317,50 +317,64 @@ const performSeed: () => Promise<void> = async () => {
317317
);
318318

319319
/**
320-
* Make approved change requests that has project 1 and 5 as wbs element
320+
* Change Requests for Creating Work Packages
321321
*/
322322

323-
const changeRequest2Id = await ChangeRequestsService.createStandardChangeRequest(
324-
thomasEmrax,
323+
const changeRequestWP1Id: number = await ChangeRequestsService.createStandardChangeRequest(
324+
cyborg,
325325
project1WbsNumber.carNumber,
326326
project1WbsNumber.projectNumber,
327327
project1WbsNumber.workPackageNumber,
328-
CR_Type.DEFINITION_CHANGE,
329-
'Remove the uncessary rule',
330-
[{ type: Scope_CR_Why_Type.DESIGN, explain: 'The rule has changed' }]
328+
CR_Type.OTHER,
329+
'Initial Change Request',
330+
[
331+
{
332+
type: Scope_CR_Why_Type.INITIALIZATION,
333+
explain: 'need this to initialize work packages'
334+
}
335+
]
331336
);
332337

333-
const proposedSolution2Id = await ChangeRequestsService.addProposedSolution(
334-
thomasEmrax,
335-
changeRequest2Id,
336-
50,
337-
'Remove the rule',
338-
1,
339-
'n/a'
338+
// make a proposed solution for it
339+
const proposedSolution2Id: string = await ChangeRequestsService.addProposedSolution(
340+
cyborg,
341+
changeRequestWP1Id,
342+
0,
343+
'Initializing seed data',
344+
0,
345+
'no scope impact'
340346
);
341347

342-
await ChangeRequestsService.reviewChangeRequest(joeShmoe, changeRequest2Id, 'LGTM', true, proposedSolution2Id);
348+
// approve the change request
349+
await ChangeRequestsService.reviewChangeRequest(batman, changeRequestWP1Id, 'LGTM', true, proposedSolution2Id);
343350

344-
const changeRequest3Id = await ChangeRequestsService.createStandardChangeRequest(
345-
thomasEmrax,
351+
const changeRequestWP5Id: number = await ChangeRequestsService.createStandardChangeRequest(
352+
cyborg,
346353
project5WbsNumber.carNumber,
347354
project5WbsNumber.projectNumber,
348355
project5WbsNumber.workPackageNumber,
349-
CR_Type.ISSUE,
350-
'Change the wire material',
351-
[{ type: Scope_CR_Why_Type.MAINTENANCE, explain: 'It would be better to maintain' }]
356+
CR_Type.OTHER,
357+
'Initial Change Request',
358+
[
359+
{
360+
type: Scope_CR_Why_Type.INITIALIZATION,
361+
explain: 'need this to initialize work packages'
362+
}
363+
]
352364
);
353365

354-
const proposedSolution3Id = await ChangeRequestsService.addProposedSolution(
355-
thomasEmrax,
356-
changeRequest3Id,
357-
50,
358-
'Change to better wire material',
359-
1,
360-
'n/a'
366+
// make a proposed solution for it
367+
const proposedSolution5Id: string = await ChangeRequestsService.addProposedSolution(
368+
cyborg,
369+
changeRequestWP5Id,
370+
0,
371+
'Initializing seed data',
372+
0,
373+
'no scope impact'
361374
);
362375

363-
await ChangeRequestsService.reviewChangeRequest(joeShmoe, changeRequest3Id, 'LGTM', true, proposedSolution3Id);
376+
// approve the change request
377+
await ChangeRequestsService.reviewChangeRequest(batman, changeRequestWP5Id, 'LGTM', true, proposedSolution5Id);
364378

365379
/**
366380
* Work Packages
@@ -369,7 +383,7 @@ const performSeed: () => Promise<void> = async () => {
369383
const { workPackageWbsNumber: workPackage1WbsNumber, workPackage: workPackage1 } = await seedWorkPackage(
370384
joeShmoe,
371385
'Bodywork Concept of Design',
372-
changeRequest2Id,
386+
changeRequestWP1Id,
373387
WorkPackageStage.Design,
374388
'01/01/2023',
375389
3,
@@ -409,7 +423,7 @@ const performSeed: () => Promise<void> = async () => {
409423
const { workPackageWbsNumber: workPackage2WbsNumber, workPackage: workPackage2 } = await seedWorkPackage(
410424
thomasEmrax,
411425
'Adhesive Shear Strength Test',
412-
changeRequest2Id,
426+
changeRequestWP1Id,
413427
WorkPackageStage.Research,
414428
'01/22/2023',
415429
5,
@@ -432,7 +446,7 @@ const performSeed: () => Promise<void> = async () => {
432446
const workPackage3WbsString = await WorkPackagesService.createWorkPackage(
433447
thomasEmrax,
434448
'Manufacture Wiring Harness',
435-
changeRequest3Id,
449+
changeRequestWP5Id,
436450
WorkPackageStage.Manufacturing,
437451
'02/01/2023',
438452
3,
@@ -459,7 +473,7 @@ const performSeed: () => Promise<void> = async () => {
459473
true
460474
);
461475

462-
const changeRequest4Id = await ChangeRequestsService.createStandardChangeRequest(
476+
const changeRequest2Id = await ChangeRequestsService.createStandardChangeRequest(
463477
thomasEmrax,
464478
project2WbsNumber.carNumber,
465479
project2WbsNumber.projectNumber,
@@ -471,16 +485,16 @@ const performSeed: () => Promise<void> = async () => {
471485
{ type: Scope_CR_Why_Type.ESTIMATION, explain: 'I estimate that it would be really pretty' }
472486
]
473487
);
474-
await ChangeRequestsService.addProposedSolution(thomasEmrax, changeRequest4Id, 50, 'Buy hot pink paint', 1, 'n/a');
488+
await ChangeRequestsService.addProposedSolution(thomasEmrax, changeRequest2Id, 50, 'Buy hot pink paint', 1, 'n/a');
475489
await ChangeRequestsService.addProposedSolution(
476490
thomasEmrax,
477-
changeRequest4Id,
491+
changeRequest2Id,
478492
40,
479493
'Buy slightly cheaper but lower quality hot pink paint',
480494
1,
481495
'n/a'
482496
);
483-
await ChangeRequestsService.reviewChangeRequest(joeShmoe, changeRequest4Id, 'What the hell Thomas', false, null);
497+
await ChangeRequestsService.reviewChangeRequest(joeShmoe, changeRequest2Id, 'What the hell Thomas', false, null);
484498

485499
await ChangeRequestsService.createActivationChangeRequest(
486500
thomasEmrax,

0 commit comments

Comments
 (0)