Skip to content

Commit 758569e

Browse files
committed
#3934 fix editing task + fix editing vendor
1 parent 4f319cc commit 758569e

6 files changed

Lines changed: 18 additions & 19 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,14 @@ export default class ReimbursementRequestsController {
496496
const editedVendor = await ReimbursementRequestService.editVendor(
497497
name,
498498
vendorId,
499-
username,
500-
password,
501-
discountCode,
502499
taxExempt,
503500
twoFactorContacts,
504-
notes,
505501
req.currentUser,
506-
req.organization
502+
req.organization,
503+
username,
504+
password,
505+
discountCode,
506+
notes
507507
);
508508
res.status(200).json(editedVendor);
509509
} catch (error: unknown) {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ reimbursementRequestsRouter.get('/reimbursements', ReimbursementRequestControlle
9696
reimbursementRequestsRouter.post(
9797
'/:vendorId/vendors/edit',
9898
nonEmptyString(body('name')),
99-
nonEmptyString(body('username')).optional(),
100-
nonEmptyString(body('password')).optional(),
101-
nonEmptyString(body('discountCode')).optional(),
99+
nonEmptyString(body('username')).optional({ checkFalsy: true }),
100+
nonEmptyString(body('password')).optional({ checkFalsy: true }),
101+
nonEmptyString(body('discountCode')).optional({ checkFalsy: true }),
102102
body('taxExempt').isBoolean(),
103103
body('twoFactorContacts').isArray(),
104104
nonEmptyString(body('twoFactorContacts.*')),
105-
nonEmptyString(body('notes')).optional(),
105+
nonEmptyString(body('notes')).optional({ checkFalsy: true }),
106106
validateInputs,
107107
ReimbursementRequestController.editVendor
108108
);

src/backend/src/routes/tasks.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tasksRouter.post(
4242
tasksRouter.post(
4343
'/:taskId/edit',
4444
nonEmptyString(body('title')),
45-
nonEmptyString(body('notes')),
45+
body('notes').isString(),
4646
isOptionalDateOnly(body('deadline')),
4747
isOptionalDateOnly(body('startDate')),
4848
isTaskPriority(body('priority')),

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,14 +1510,14 @@ export default class ReimbursementRequestService {
15101510
static async editVendor(
15111511
name: string,
15121512
vendorId: string,
1513-
username: string,
1514-
password: string,
1515-
discountCode: string,
15161513
taxExempt: boolean,
15171514
twoFactorContacts: string[],
1518-
notes: string,
15191515
submitter: User,
1520-
organization: Organization
1516+
organization: Organization,
1517+
username?: string,
1518+
password?: string,
1519+
discountCode?: string,
1520+
notes?: string
15211521
): Promise<Vendor> {
15221522
const existingVendor = await prisma.vendor.findUnique({
15231523
where: { vendorId, dateDeleted: null },

src/frontend/src/pages/CalendarPage/TaskClickPopup.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ export const TaskClickContent: React.FC<TaskClickContentProps> = ({ task, onClos
6464
notes: data.notes,
6565
priority: data.priority,
6666
startDate: data.startDate,
67-
deadline: data.deadline
67+
deadline: data.deadline,
68+
wbsNum: task.wbsNum
6869
});
6970
await editAssignees({
7071
taskId: task.taskId,

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/v2/TaskCard.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ export const TaskCard = ({
7777
wpWbsNum
7878
}: EditTaskFormInput) => {
7979
try {
80-
// uses the project's wbs element id as fallback if no wp was selected
81-
const targetWbsNum =
82-
wpWbsNum ?? (task.wbsNum.workPackageNumber !== 0 ? { ...wbsNum, workPackageNumber: 0 } : undefined);
80+
const targetWbsNum = wpWbsNum ?? task.wbsNum;
8381

8482
await editTask({
8583
taskId,

0 commit comments

Comments
 (0)