@zeniai/client-epic-state 5.0.84-betaJK3 → 5.0.84-betaJK4
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.
|
@@ -2,7 +2,7 @@ import { from, of } from 'rxjs';
|
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { convertHHMMStrToMinutes } from '../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM';
|
|
4
4
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { appendSubTaskId, updateTasks } from '../../../../entity/task/taskReducer';
|
|
5
|
+
import { appendSubTaskId, updateTasks, } from '../../../../entity/task/taskReducer';
|
|
6
6
|
import { getTaskById } from '../../../../entity/task/taskSelector';
|
|
7
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
8
8
|
import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
|
|
@@ -12,7 +12,7 @@ export const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
12
12
|
const parentTask = getTaskById(state.taskState, action.payload.parentTaskId);
|
|
13
13
|
const parentTaskGroupId = parentTask?.taskGroupIds[0];
|
|
14
14
|
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
15
|
-
const payload = prepareSubTaskPayload(action.payload);
|
|
15
|
+
const payload = prepareSubTaskPayload(action.payload, parentTaskGroupId);
|
|
16
16
|
return zeniAPI
|
|
17
17
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
18
18
|
.pipe(mergeMap((response) => {
|
|
@@ -36,8 +36,7 @@ export const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
36
36
|
type: 'success',
|
|
37
37
|
}),
|
|
38
38
|
];
|
|
39
|
-
if (isTaskListFetched === true &&
|
|
40
|
-
parentTaskGroupId != null) {
|
|
39
|
+
if (isTaskListFetched === true && parentTaskGroupId != null) {
|
|
41
40
|
actions.push(updateTaskListOnNewTaskCreationSuccess({
|
|
42
41
|
taskGroupId: parentTaskGroupId,
|
|
43
42
|
task: response.data.tasks[0],
|
|
@@ -67,7 +66,7 @@ export const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
67
66
|
JSON.stringify(error)),
|
|
68
67
|
}))));
|
|
69
68
|
}));
|
|
70
|
-
const prepareSubTaskPayload = (subTask) => ({
|
|
69
|
+
const prepareSubTaskPayload = (subTask, parentTaskGroupId) => ({
|
|
71
70
|
name: subTask.name,
|
|
72
71
|
assignees: subTask.assignee,
|
|
73
72
|
description: subTask.description,
|
|
@@ -77,4 +76,5 @@ const prepareSubTaskPayload = (subTask) => ({
|
|
|
77
76
|
time_spent: convertHHMMStrToMinutes(subTask.timeSpent),
|
|
78
77
|
group_assignees: subTask.groupAssignees,
|
|
79
78
|
parent_task_id: subTask.parentTaskId,
|
|
79
|
+
task_group_ids: parentTaskGroupId == null ? [] : [parentTaskGroupId],
|
|
80
80
|
});
|
|
@@ -15,7 +15,7 @@ const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
15
15
|
const parentTask = (0, taskSelector_1.getTaskById)(state.taskState, action.payload.parentTaskId);
|
|
16
16
|
const parentTaskGroupId = parentTask?.taskGroupIds[0];
|
|
17
17
|
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
18
|
-
const payload = prepareSubTaskPayload(action.payload);
|
|
18
|
+
const payload = prepareSubTaskPayload(action.payload, parentTaskGroupId);
|
|
19
19
|
return zeniAPI
|
|
20
20
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
21
21
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
@@ -39,8 +39,7 @@ const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
39
39
|
type: 'success',
|
|
40
40
|
}),
|
|
41
41
|
];
|
|
42
|
-
if (isTaskListFetched === true &&
|
|
43
|
-
parentTaskGroupId != null) {
|
|
42
|
+
if (isTaskListFetched === true && parentTaskGroupId != null) {
|
|
44
43
|
actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
45
44
|
taskGroupId: parentTaskGroupId,
|
|
46
45
|
task: response.data.tasks[0],
|
|
@@ -71,7 +70,7 @@ const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
71
70
|
}))));
|
|
72
71
|
}));
|
|
73
72
|
exports.createSubTaskEpic = createSubTaskEpic;
|
|
74
|
-
const prepareSubTaskPayload = (subTask) => ({
|
|
73
|
+
const prepareSubTaskPayload = (subTask, parentTaskGroupId) => ({
|
|
75
74
|
name: subTask.name,
|
|
76
75
|
assignees: subTask.assignee,
|
|
77
76
|
description: subTask.description,
|
|
@@ -81,4 +80,5 @@ const prepareSubTaskPayload = (subTask) => ({
|
|
|
81
80
|
time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(subTask.timeSpent),
|
|
82
81
|
group_assignees: subTask.groupAssignees,
|
|
83
82
|
parent_task_id: subTask.parentTaskId,
|
|
83
|
+
task_group_ids: parentTaskGroupId == null ? [] : [parentTaskGroupId],
|
|
84
84
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.84-
|
|
3
|
+
"version": "5.0.84-betaJK4",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|