Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 8db036e

Browse files
committed
fix: saving RB
refactored saving Jobs the same way
1 parent 17727a4 commit 8db036e

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

src/routes/JobForm/index.jsx

+16-16
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,22 @@ const JobForm = ({ teamId, jobId }) => {
5959
}
6060
};
6161

62-
const getRequestData = (values) => {
63-
return {
64-
projectId: values.projectId,
65-
externalId: values.externalId,
66-
description: values.description,
67-
title: values.title,
68-
startDate: values.startDate,
69-
duration: values.duration,
70-
numPositions: values.numPositions,
71-
resourceType: values.resourceType,
72-
rateType: values.rateType,
73-
workload: values.workload,
74-
skills: values.skills,
75-
status: values.status,
76-
};
77-
};
62+
// as we are using `PUT` method (not `PATCH`) we have send ALL the fields
63+
// fields which we don't send would become `null` otherwise
64+
const getRequestData = (values) => _.pick(values, [
65+
'projectId',
66+
'externalId',
67+
'description',
68+
'title',
69+
'startDate',
70+
'duration',
71+
'numPositions',
72+
'resourceType',
73+
'rateType',
74+
'workload',
75+
'skills',
76+
'status',
77+
]);
7878

7979
useEffect(() => {
8080
if (skills && job && !options) {

src/routes/ResourceBookingForm/index.jsx

+13-12
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,19 @@ const ResourceBookingDetails = ({ teamId, resourceBookingId }) => {
6767
);
6868
};
6969

70-
const getRequestData = (values) => {
71-
return {
72-
projectId: values.projectId,
73-
startDate: values.startDate,
74-
endDate: values.endDate,
75-
memberRate: values.memberRate,
76-
customerRate: values.customerRate,
77-
status: values.status,
78-
userId: values.userId,
79-
rateType: values.rateType,
80-
};
81-
};
70+
// as we are using `PUT` method (not `PATCH`) we have send ALL the fields
71+
// fields which we don't send would become `null` otherwise
72+
const getRequestData = (values) => _.pick(values, [
73+
'projectId',
74+
'userId',
75+
'jobId',
76+
'status',
77+
'startDate',
78+
'endDate',
79+
'memberRate',
80+
'customerRate',
81+
'rateType',
82+
]);
8283

8384
return (
8485
<Page title="Edit Member Details">

0 commit comments

Comments
 (0)