Skip to content

Commit 350b146

Browse files
committed
Merge branch '#1524-Delete-Material-Type-Endpoint' of https://github.com/Northeastern-Electric-Racing/FinishLine into #1524-Delete-Material-Type-Endpoint
2 parents 902531e + c691440 commit 350b146

44 files changed

Lines changed: 728 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/backend/src/controllers/change-requests.controllers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@ export default class ChangeRequestsController {
7575

7676
static async createStandardChangeRequest(req: Request, res: Response, next: NextFunction) {
7777
try {
78-
const { wbsNum, type, what, why } = req.body;
78+
const { wbsNum, type, what, why, proposedSolutions } = req.body;
7979
const submitter = await getCurrentUser(res);
80-
const id = await ChangeRequestsService.createStandardChangeRequest(
80+
const createdCR = await ChangeRequestsService.createStandardChangeRequest(
8181
submitter,
8282
wbsNum.carNumber,
8383
wbsNum.projectNumber,
8484
wbsNum.workPackageNumber,
8585
type,
8686
what,
87-
why
87+
why,
88+
proposedSolutions
8889
);
89-
return res.status(200).json({ message: `${id}` });
90+
return res.status(200).json(createdCR);
9091
} catch (error: unknown) {
9192
next(error);
9293
}

src/backend/src/controllers/projects.controllers.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Project, validateWBS, WbsNumber, wbsPipe } from 'shared';
22
import { NextFunction, Request, Response } from 'express';
3-
import { User } from '@prisma/client';
3+
import { Manufacturer, User } from '@prisma/client';
44
import { getCurrentUser } from '../utils/auth.utils';
55
import ProjectsService from '../services/projects.services';
66

@@ -193,6 +193,16 @@ export default class ProjectsController {
193193
}
194194
}
195195

196+
static async getAllManufacturers(req: Request, res: Response, next: NextFunction) {
197+
try {
198+
const user = await getCurrentUser(res);
199+
const manufacturers: Manufacturer[] = await ProjectsService.getAllManufacturers(user);
200+
return res.status(200).json(manufacturers);
201+
} catch (error: unknown) {
202+
next(error);
203+
}
204+
}
205+
196206
static async createMaterialType(req: Request, res: Response, next: NextFunction) {
197207
try {
198208
const { name } = req.body;

src/backend/src/controllers/reimbursement-requests.controllers.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@ export default class ReimbursementRequestsController {
230230
}
231231
}
232232

233+
static async denyReimbursementRequest(req: Request, res: Response, next: NextFunction) {
234+
try {
235+
const { requestId } = req.params;
236+
const user = await getCurrentUser(res);
237+
const reimbursementStatus = await ReimbursementRequestService.denyReimbursementRequest(requestId, user);
238+
res.status(200).json(reimbursementStatus);
239+
} catch (error: unknown) {
240+
next(error);
241+
}
242+
}
243+
233244
static async markReimbursementRequestAsDelivered(req: Request, res: Response, next: NextFunction) {
234245
try {
235246
const { requestId } = req.params;

src/backend/src/controllers/work-packages.controllers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ export default class WorkPackagesController {
2929
}
3030
}
3131

32+
static async getManyWorkPackages(req: Request, res: Response, next: NextFunction) {
33+
try {
34+
const { wbsNums } = req.body;
35+
const workPackages: WorkPackage[] = await WorkPackagesService.getManyWorkPackages(wbsNums);
36+
res.status(200).json(workPackages);
37+
} catch (error: unknown) {
38+
next(error);
39+
}
40+
}
41+
3242
// Create a work package with the given details
3343
static async createWorkPackage(req: Request, res: Response, next: NextFunction) {
3444
try {

src/backend/src/integrations/slack.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { WebClient } from '@slack/web-api';
2+
import { HttpException } from '../utils/errors.utils';
23

34
const slack = new WebClient(process.env.SLACK_BOT_TOKEN);
45

@@ -40,13 +41,17 @@ export const sendMessage = async (slackId: string, message: string, link?: strin
4041
}
4142
};
4243

43-
await slack.chat.postMessage({
44-
token: SLACK_BOT_TOKEN,
45-
channel: slackId,
46-
text: message,
47-
blocks: [block],
48-
unfurl_links: false
49-
});
44+
try {
45+
await slack.chat.postMessage({
46+
token: SLACK_BOT_TOKEN,
47+
channel: slackId,
48+
text: message,
49+
blocks: [block],
50+
unfurl_links: false
51+
});
52+
} catch (error) {
53+
throw new HttpException(500, 'Error sending slack message, reason: ' + (error as any).data.error);
54+
}
5055
};
5156

5257
export default slack;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* This file is part of NER's FinishLine and licensed under GNU AGPLv3.
3+
* See the LICENSE file in the repository root folder for details.
4+
*/
5+
6+
import { Prisma } from '@prisma/client';
7+
8+
const manufacturerQueryArgs = Prisma.validator<Prisma.ManufacturerArgs>()({
9+
include: {
10+
materials: true
11+
}
12+
});
13+
14+
export default manufacturerQueryArgs;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterEnum
2+
ALTER TYPE "Reimbursement_Status_Type" ADD VALUE 'DENIED';

src/backend/src/prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ enum Reimbursement_Status_Type {
364364
SABO_SUBMITTED
365365
ADVISOR_APPROVED
366366
REIMBURSED
367+
DENIED
367368
}
368369

369370
model Reimbursement_Status {

src/backend/src/prisma/seed-data/users.seed.ts

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,70 @@ const wonderwoman: Prisma.UserCreateInput = {
6969
googleAuthId: 'wonderwoman'
7070
};
7171

72+
const lexLuther: Prisma.UserCreateInput = {
73+
firstName: 'Alexander',
74+
lastName: 'Luther',
75+
email: 'lexluther@justiceleague.com',
76+
googleAuthId: 'hjkklo',
77+
role: Role.MEMBER
78+
};
79+
80+
const hawkgirl: Prisma.UserCreateInput = {
81+
firstName: 'Shiera',
82+
lastName: 'Hall',
83+
email: 'hawkgirl@justiceleague.com',
84+
googleAuthId: 'bhuujki',
85+
role: Role.MEMBER
86+
};
87+
88+
const elongatedMan: Prisma.UserCreateInput = {
89+
firstName: 'Randolph',
90+
lastName: 'Dibney',
91+
email: 'elongatedmangit @justiceleague.com',
92+
googleAuthId: 'joigiug',
93+
role: Role.MEMBER
94+
};
95+
96+
const zatanna: Prisma.UserCreateInput = {
97+
firstName: 'Zatanna',
98+
lastName: 'Zatara',
99+
email: 'zatanna@justiceleague.com',
100+
googleAuthId: 'cawwww',
101+
role: Role.MEMBER
102+
};
103+
104+
const phantomStranger: Prisma.UserCreateInput = {
105+
firstName: 'Judas',
106+
lastName: 'Iscariot',
107+
email: 'phantomstranger@justiceleague.com',
108+
googleAuthId: 'bnhjiuy',
109+
role: Role.MEMBER
110+
};
111+
112+
const redTornado: Prisma.UserCreateInput = {
113+
firstName: 'Red',
114+
lastName: 'Tornado',
115+
email: 'redtornado@justiceleague.com',
116+
googleAuthId: 'vbnhught',
117+
role: Role.MEMBER
118+
};
119+
120+
const firestorm: Prisma.UserCreateInput = {
121+
firstName: 'Ronnie',
122+
lastName: 'Raymond',
123+
email: 'firestorm@justiceleague.com',
124+
googleAuthId: 'fghttyu',
125+
role: Role.MEMBER
126+
};
127+
128+
const hankHeywood: Prisma.UserCreateInput = {
129+
firstName: 'Hank',
130+
lastName: 'Heywood III',
131+
email: 'hankheywood@justiceleague.com',
132+
googleAuthId: 'hudhsgf',
133+
role: Role.MEMBER
134+
};
135+
72136
const flash: Prisma.UserCreateInput = {
73137
firstName: 'Barry',
74138
lastName: 'Allen',
@@ -572,13 +636,85 @@ const babyDollJacobson: Prisma.UserCreateInput = {
572636
role: Role.LEADERSHIP
573637
};
574638

639+
const frostBite: Prisma.UserCreateInput = {
640+
firstName: 'Frost',
641+
lastName: 'Bite',
642+
googleAuthId: 'husky1',
643+
email: 'frostbite@northeastern.edu',
644+
role: Role.MEMBER
645+
};
646+
647+
const winter: Prisma.UserCreateInput = {
648+
firstName: 'Winter',
649+
lastName: 'Warrior',
650+
googleAuthId: 'husky2',
651+
email: 'winterwarrior@northeastern.edu',
652+
role: Role.MEMBER
653+
};
654+
655+
const paws: Prisma.UserCreateInput = {
656+
firstName: 'Paws',
657+
lastName: 'The-Dog',
658+
googleAuthId: 'husky3',
659+
email: 'paws@northeastern.edu',
660+
role: Role.MEMBER
661+
};
662+
663+
const snowPaws: Prisma.UserCreateInput = {
664+
firstName: 'Snow',
665+
lastName: 'Paws',
666+
googleAuthId: 'husky4',
667+
email: 'snowpaws@northeastern.edu',
668+
role: Role.MEMBER
669+
};
670+
671+
const whiteTail: Prisma.UserCreateInput = {
672+
firstName: 'White',
673+
lastName: 'Tail',
674+
googleAuthId: 'husky5',
675+
email: 'whitetail@northeastern.edu',
676+
role: Role.MEMBER
677+
};
678+
679+
const husky: Prisma.UserCreateInput = {
680+
firstName: 'Husky',
681+
lastName: 'Dog',
682+
googleAuthId: 'husky6',
683+
email: 'huskydog@northeastern.edu',
684+
role: Role.MEMBER
685+
};
686+
687+
const howler: Prisma.UserCreateInput = {
688+
firstName: 'Howler',
689+
lastName: 'Husky',
690+
googleAuthId: 'husky7',
691+
email: 'howler@northeastern.edu',
692+
role: Role.MEMBER
693+
};
694+
695+
const snowBite: Prisma.UserCreateInput = {
696+
firstName: 'Snow',
697+
lastName: 'Bite',
698+
googleAuthId: 'husky8',
699+
email: 'SnowBite@northeastern.edu',
700+
role: Role.MEMBER
701+
};
702+
575703
export const dbSeedAllUsers = {
576704
thomasEmrax,
577705
joeShmoe,
578706
joeBlow,
579707
wonderwoman,
580708
flash,
581709
aquaman,
710+
lexLuther,
711+
hawkgirl,
712+
elongatedMan,
713+
zatanna,
714+
phantomStranger,
715+
redTornado,
716+
firestorm,
717+
hankHeywood,
582718
robin,
583719
batman,
584720
superman,
@@ -637,5 +773,13 @@ export const dbSeedAllUsers = {
637773
kenWilliams,
638774
boogPowell,
639775
mannyMachado,
640-
babyDollJacobson
776+
babyDollJacobson,
777+
frostBite,
778+
winter,
779+
snowPaws,
780+
paws,
781+
whiteTail,
782+
husky,
783+
howler,
784+
snowBite
641785
};

0 commit comments

Comments
 (0)