@zeniai/client-epic-state 4.20.2-beta31RR → 4.20.2-beta32RR
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,12 +9,17 @@ import { bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksFailure, updateTask
|
|
|
9
9
|
export const bulkUpdateTaskListEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(bulkUpdateTaskList.match), switchMap((action) => {
|
|
10
10
|
const state = state$.value;
|
|
11
11
|
const { taskIds, updates, groupId } = action.payload;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
// Move-to-group uses old endpoint with full task objects;
|
|
13
|
+
// all other bulk operations use the bulk-update endpoint
|
|
14
|
+
const isMoveToGroup = groupId != null;
|
|
15
|
+
const url = isMoveToGroup
|
|
16
|
+
? `${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`
|
|
17
|
+
: `${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/bulk-update`;
|
|
18
|
+
const payload = isMoveToGroup
|
|
19
|
+
? { tasks: getTasksListPayload(state, taskIds, updates) }
|
|
20
|
+
: { task_ids: taskIds, updates: toBulkUpdatesPayload(updates) };
|
|
16
21
|
return zeniAPI
|
|
17
|
-
.putAndGetJSON(
|
|
22
|
+
.putAndGetJSON(url, payload)
|
|
18
23
|
.pipe(mergeMap((response) => {
|
|
19
24
|
if (isSuccessResponse(response) && response.data != null) {
|
|
20
25
|
return of(updateTasks(response.data.tasks), updateTasksListOnBulkUpdateTasksSuccess({
|
|
@@ -34,7 +39,7 @@ export const bulkUpdateTaskListEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
34
39
|
}));
|
|
35
40
|
}));
|
|
36
41
|
}));
|
|
37
|
-
const toBulkUpdatesPayload = (
|
|
42
|
+
const toBulkUpdatesPayload = (updates) => {
|
|
38
43
|
const payload = {};
|
|
39
44
|
if (updates.status != null) {
|
|
40
45
|
payload.status = updates.status.code;
|
|
@@ -69,9 +74,6 @@ const toBulkUpdatesPayload = (_state, updates, groupId) => {
|
|
|
69
74
|
payload.snoozed_at = null;
|
|
70
75
|
payload.is_snooze_notification_sent = false;
|
|
71
76
|
}
|
|
72
|
-
if (groupId != null) {
|
|
73
|
-
payload.task_group_ids = [groupId];
|
|
74
|
-
}
|
|
75
77
|
return payload;
|
|
76
78
|
};
|
|
77
79
|
export const getTasksListPayload = (state, taskIds, updates) => {
|