2021-06-24 01:05:22 +05:00
|
|
|
import ActionTypes from '../constants/ActionTypes';
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
const createProjectManager = (projectManager) => ({
|
2021-06-24 01:05:22 +05:00
|
|
|
type: ActionTypes.PROJECT_MANAGER_CREATE,
|
|
|
|
payload: {
|
|
|
|
projectManager,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
createProjectManager.success = (localId, projectManager) => ({
|
|
|
|
type: ActionTypes.PROJECT_MANAGER_CREATE__SUCCESS,
|
|
|
|
payload: {
|
|
|
|
localId,
|
|
|
|
projectManager,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
createProjectManager.failure = (localId, error) => ({
|
|
|
|
type: ActionTypes.PROJECT_MANAGER_CREATE__FAILURE,
|
|
|
|
payload: {
|
|
|
|
localId,
|
|
|
|
error,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
const handleProjectManagerCreate = (
|
2021-06-24 01:05:22 +05:00
|
|
|
projectManager,
|
|
|
|
project,
|
|
|
|
board,
|
|
|
|
users,
|
|
|
|
projectManagers,
|
|
|
|
boards,
|
|
|
|
boardMemberships,
|
|
|
|
labels,
|
|
|
|
lists,
|
|
|
|
cards,
|
|
|
|
cardMemberships,
|
|
|
|
cardLabels,
|
|
|
|
tasks,
|
|
|
|
attachments,
|
2022-08-04 13:31:14 +02:00
|
|
|
deletedNotifications,
|
2021-06-24 01:05:22 +05:00
|
|
|
) => ({
|
|
|
|
type: ActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
|
|
|
|
payload: {
|
|
|
|
projectManager,
|
|
|
|
project,
|
|
|
|
board,
|
|
|
|
users,
|
|
|
|
projectManagers,
|
|
|
|
boards,
|
|
|
|
boardMemberships,
|
|
|
|
labels,
|
|
|
|
lists,
|
|
|
|
cards,
|
|
|
|
cardMemberships,
|
|
|
|
cardLabels,
|
|
|
|
tasks,
|
|
|
|
attachments,
|
2022-08-04 13:31:14 +02:00
|
|
|
deletedNotifications,
|
2021-06-24 01:05:22 +05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
handleProjectManagerCreate.fetchProject = (id, currentUserId, currentBoardId) => ({
|
|
|
|
type: ActionTypes.PROJECT_MANAGER_CREATE_HANDLE__PROJECT_FETCH,
|
|
|
|
payload: {
|
|
|
|
id,
|
|
|
|
currentUserId,
|
|
|
|
currentBoardId,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
const deleteProjectManager = (id, isCurrentUser, isCurrentProject) => ({
|
2021-06-24 01:05:22 +05:00
|
|
|
type: ActionTypes.PROJECT_MANAGER_DELETE,
|
|
|
|
payload: {
|
|
|
|
id,
|
|
|
|
isCurrentUser,
|
|
|
|
isCurrentProject,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
deleteProjectManager.success = (projectManager) => ({
|
|
|
|
type: ActionTypes.PROJECT_MANAGER_DELETE__SUCCESS,
|
|
|
|
payload: {
|
|
|
|
projectManager,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
deleteProjectManager.failure = (id, error) => ({
|
|
|
|
type: ActionTypes.PROJECT_MANAGER_DELETE__FAILURE,
|
|
|
|
payload: {
|
|
|
|
id,
|
|
|
|
error,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurrentProject) => ({
|
2021-06-24 01:05:22 +05:00
|
|
|
type: ActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
|
|
|
|
payload: {
|
|
|
|
projectManager,
|
|
|
|
isCurrentUser,
|
|
|
|
isCurrentProject,
|
|
|
|
},
|
|
|
|
});
|
2022-08-04 13:31:14 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
createProjectManager,
|
|
|
|
handleProjectManagerCreate,
|
|
|
|
deleteProjectManager,
|
|
|
|
handleProjectManagerDelete,
|
|
|
|
};
|