Skip to content

Commit 971c473

Browse files
committed
#1320 Fix optional/null fields
1 parent 3cbc671 commit 971c473

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ export default class ProjectsController {
5252
name,
5353
summary,
5454
teamIds,
55-
budget || null,
56-
links || null,
57-
rules || null,
58-
goals || null,
59-
features || null,
60-
otherConstraints || null,
61-
projectLeadId || null,
62-
projectManagerId || null
55+
budget,
56+
links,
57+
rules,
58+
goals,
59+
features,
60+
otherConstraints,
61+
projectLeadId,
62+
projectManagerId
6363
);
6464

6565
return res.status(200).json(wbsPipe(createdWbsNumber));

src/backend/src/routes/projects.routes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ projectRouter.get('/:wbsNum', ProjectsController.getSingleProject);
1313
const projectValidators = [
1414
intMinZero(body('crId')),
1515
nonEmptyString(body('name')),
16-
body('budget').optional().isInt({ min: 0 }).default(0),
1716
nonEmptyString(body('summary')),
1817
body('rules').isArray(),
1918
nonEmptyString(body('rules.*')),
@@ -38,13 +37,15 @@ projectRouter.post(
3837
intMinZero(body('carNumber')),
3938
body('teamIds').isArray(),
4039
intMinZero(body('teamIds.*')),
40+
body('budget').optional().isInt({ min: 0 }).default(0),
4141
...projectValidators,
4242
validateInputs,
4343
ProjectsController.createProject
4444
);
4545
projectRouter.post(
4646
'/edit',
4747
intMinZero(body('projectId')),
48+
intMinZero(body('budget')),
4849
...projectValidators,
4950
validateInputs,
5051
ProjectsController.editProject

0 commit comments

Comments
 (0)