ref: Refactoring

This commit is contained in:
Maksim Eltyshev
2022-08-04 13:31:14 +02:00
parent 1f569bdb61
commit 3714bbc06f
189 changed files with 3781 additions and 3486 deletions

View File

@@ -0,0 +1,42 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const fetchActivitiesInCurrentCard = () => ({
type: EntryActionTypes.ACTIVITIES_IN_CURRENT_CARD_FETCH,
payload: {},
});
const toggleActivitiesDetailsInCurrentCard = (isVisible) => ({
type: EntryActionTypes.ACTIVITIES_DETAILS_IN_CURRENT_CARD_TOGGLE,
payload: {
isVisible,
},
});
const handleActivityCreate = (activity) => ({
type: EntryActionTypes.ACTIVITY_CREATE_HANDLE,
payload: {
activity,
},
});
const handleActivityUpdate = (activity) => ({
type: EntryActionTypes.ACTIVITY_UPDATE_HANDLE,
payload: {
activity,
},
});
const handleActivityDelete = (activity) => ({
type: EntryActionTypes.ACTIVITY_DELETE_HANDLE,
payload: {
activity,
},
});
export default {
fetchActivitiesInCurrentCard,
toggleActivitiesDetailsInCurrentCard,
handleActivityCreate,
handleActivityUpdate,
handleActivityDelete,
};

View File

@@ -0,0 +1,54 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createAttachmentInCurrentCard = (data) => ({
type: EntryActionTypes.ATTACHMENT_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
const handleAttachmentCreate = (attachment, requestId) => ({
type: EntryActionTypes.ATTACHMENT_CREATE_HANDLE,
payload: {
attachment,
requestId,
},
});
const updateAttachment = (id, data) => ({
type: EntryActionTypes.ATTACHMENT_UPDATE,
payload: {
id,
data,
},
});
const handleAttachmentUpdate = (attachment) => ({
type: EntryActionTypes.ATTACHMENT_UPDATE_HANDLE,
payload: {
attachment,
},
});
const deleteAttachment = (id) => ({
type: EntryActionTypes.ATTACHMENT_DELETE,
payload: {
id,
},
});
const handleAttachmentDelete = (attachment) => ({
type: EntryActionTypes.ATTACHMENT_DELETE_HANDLE,
payload: {
attachment,
},
});
export default {
createAttachmentInCurrentCard,
handleAttachmentCreate,
updateAttachment,
handleAttachmentUpdate,
deleteAttachment,
handleAttachmentDelete,
};

View File

@@ -0,0 +1,36 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createMembershipInCurrentBoard = (data) => ({
type: EntryActionTypes.MEMBERSHIP_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
const handleBoardMembershipCreate = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
payload: {
boardMembership,
},
});
const deleteBoardMembership = (id) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE,
payload: {
id,
},
});
const handleBoardMembershipDelete = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
payload: {
boardMembership,
},
});
export default {
createMembershipInCurrentBoard,
handleBoardMembershipCreate,
deleteBoardMembership,
handleBoardMembershipDelete,
};

View File

@@ -0,0 +1,70 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createBoardInCurrentProject = (data) => ({
type: EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE,
payload: {
data,
},
});
const handleBoardCreate = (board) => ({
type: EntryActionTypes.BOARD_CREATE_HANDLE,
payload: {
board,
},
});
const fetchBoard = (id) => ({
type: EntryActionTypes.BOARD_FETCH,
payload: {
id,
},
});
const updateBoard = (id, data) => ({
type: EntryActionTypes.BOARD_UPDATE,
payload: {
id,
data,
},
});
const handleBoardUpdate = (board) => ({
type: EntryActionTypes.BOARD_UPDATE_HANDLE,
payload: {
board,
},
});
const moveBoard = (id, index) => ({
type: EntryActionTypes.BOARD_MOVE,
payload: {
id,
index,
},
});
const deleteBoard = (id) => ({
type: EntryActionTypes.BOARD_DELETE,
payload: {
id,
},
});
const handleBoardDelete = (board) => ({
type: EntryActionTypes.BOARD_DELETE_HANDLE,
payload: {
board,
},
});
export default {
createBoardInCurrentProject,
handleBoardCreate,
fetchBoard,
updateBoard,
handleBoardUpdate,
moveBoard,
deleteBoard,
handleBoardDelete,
};

108
client/src/entry-actions/cards.js Executable file
View File

@@ -0,0 +1,108 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createCard = (listId, data) => ({
type: EntryActionTypes.CARD_CREATE,
payload: {
listId,
data,
},
});
const handleCardCreate = (card) => ({
type: EntryActionTypes.CARD_CREATE_HANDLE,
payload: {
card,
},
});
const updateCard = (id, data) => ({
type: EntryActionTypes.CARD_UPDATE,
payload: {
id,
data,
},
});
const updateCurrentCard = (data) => ({
type: EntryActionTypes.CURRENT_CARD_UPDATE,
payload: {
data,
},
});
const handleCardUpdate = (card) => ({
type: EntryActionTypes.CARD_UPDATE_HANDLE,
payload: {
card,
},
});
const moveCard = (id, listId, index = 0) => ({
type: EntryActionTypes.CARD_MOVE,
payload: {
id,
listId,
index,
},
});
const moveCurrentCard = (listId, index = 0) => ({
type: EntryActionTypes.CURRENT_CARD_MOVE,
payload: {
listId,
index,
},
});
const transferCard = (id, boardId, listId, index = 0) => ({
type: EntryActionTypes.CARD_TRANSFER,
payload: {
id,
boardId,
listId,
index,
},
});
const transferCurrentCard = (boardId, listId, index = 0) => ({
type: EntryActionTypes.CURRENT_CARD_TRANSFER,
payload: {
boardId,
listId,
index,
},
});
const deleteCard = (id) => ({
type: EntryActionTypes.CARD_DELETE,
payload: {
id,
},
});
const deleteCurrentCard = () => ({
type: EntryActionTypes.CURRENT_CARD_DELETE,
payload: {},
});
const handleCardDelete = (card) => ({
type: EntryActionTypes.CARD_DELETE_HANDLE,
payload: {
card,
},
});
export default {
createCard,
handleCardCreate,
updateCard,
updateCurrentCard,
handleCardUpdate,
moveCard,
moveCurrentCard,
transferCard,
transferCurrentCard,
deleteCard,
deleteCurrentCard,
handleCardDelete,
};

View File

@@ -0,0 +1,29 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createCommentActivityInCurrentCard = (data) => ({
type: EntryActionTypes.COMMENT_ACTIVITY_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
const updateCommentActivity = (id, data) => ({
type: EntryActionTypes.COMMENT_ACTIVITY_UPDATE,
payload: {
id,
data,
},
});
const deleteCommentActivity = (id) => ({
type: EntryActionTypes.COMMENT_ACTIVITY_DELETE,
payload: {
id,
},
});
export default {
createCommentActivityInCurrentCard,
updateCommentActivity,
deleteCommentActivity,
};

View File

@@ -0,0 +1,16 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const initializeCore = () => ({
type: EntryActionTypes.CORE_INITIALIZE,
payload: {},
});
const logout = () => ({
type: EntryActionTypes.LOGOUT,
payload: {},
});
export default {
initializeCore,
logout,
};

View File

@@ -0,0 +1,37 @@
import socket from './socket';
import login from './login';
import core from './core';
import modals from './modals';
import users from './users';
import projects from './projects';
import projectManagers from './project-managers';
import boards from './boards';
import boardMemberships from './board-memberships';
import labels from './labels';
import lists from './lists';
import cards from './cards';
import tasks from './tasks';
import attachments from './attachments';
import activities from './activities';
import commentActivities from './comment-activities';
import notifications from './notifications';
export default {
...socket,
...login,
...core,
...modals,
...users,
...projects,
...projectManagers,
...boards,
...boardMemberships,
...labels,
...lists,
...cards,
...tasks,
...attachments,
...activities,
...commentActivities,
...notifications,
};

View File

@@ -0,0 +1,119 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createLabelInCurrentBoard = (data) => ({
type: EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
const handleLabelCreate = (label) => ({
type: EntryActionTypes.LABEL_CREATE_HANDLE,
payload: {
label,
},
});
const updateLabel = (id, data) => ({
type: EntryActionTypes.LABEL_UPDATE,
payload: {
id,
data,
},
});
const handleLabelUpdate = (label) => ({
type: EntryActionTypes.LABEL_UPDATE_HANDLE,
payload: {
label,
},
});
const deleteLabel = (id) => ({
type: EntryActionTypes.LABEL_DELETE,
payload: {
id,
},
});
const handleLabelDelete = (label) => ({
type: EntryActionTypes.LABEL_DELETE_HANDLE,
payload: {
label,
},
});
const addLabelToCard = (id, cardId) => ({
type: EntryActionTypes.LABEL_TO_CARD_ADD,
payload: {
id,
cardId,
},
});
const addLabelToCurrentCard = (id) => ({
type: EntryActionTypes.LABEL_TO_CURRENT_CARD_ADD,
payload: {
id,
},
});
const handleLabelToCardAdd = (cardLabel) => ({
type: EntryActionTypes.LABEL_TO_CARD_ADD_HANDLE,
payload: {
cardLabel,
},
});
const removeLabelFromCard = (id, cardId) => ({
type: EntryActionTypes.LABEL_FROM_CARD_REMOVE,
payload: {
id,
cardId,
},
});
const removeLabelFromCurrentCard = (id) => ({
type: EntryActionTypes.LABEL_FROM_CURRENT_CARD_REMOVE,
payload: {
id,
},
});
const handleLabelFromCardRemove = (cardLabel) => ({
type: EntryActionTypes.LABEL_FROM_CARD_REMOVE_HANDLE,
payload: {
cardLabel,
},
});
const addLabelToFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD,
payload: {
id,
},
});
const removeLabelFromFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE,
payload: {
id,
},
});
export default {
createLabelInCurrentBoard,
handleLabelCreate,
updateLabel,
handleLabelUpdate,
deleteLabel,
handleLabelDelete,
addLabelToCard,
addLabelToCurrentCard,
handleLabelToCardAdd,
removeLabelFromCard,
removeLabelFromCurrentCard,
handleLabelFromCardRemove,
addLabelToFilterInCurrentBoard,
removeLabelFromFilterInCurrentBoard,
};

View File

@@ -0,0 +1,62 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createListInCurrentBoard = (data) => ({
type: EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
const handleListCreate = (list) => ({
type: EntryActionTypes.LIST_CREATE_HANDLE,
payload: {
list,
},
});
const updateList = (id, data) => ({
type: EntryActionTypes.LIST_UPDATE,
payload: {
id,
data,
},
});
const handleListUpdate = (list) => ({
type: EntryActionTypes.LIST_UPDATE_HANDLE,
payload: {
list,
},
});
const moveList = (id, index) => ({
type: EntryActionTypes.LIST_MOVE,
payload: {
id,
index,
},
});
const deleteList = (id) => ({
type: EntryActionTypes.LIST_DELETE,
payload: {
id,
},
});
const handleListDelete = (list) => ({
type: EntryActionTypes.LIST_DELETE_HANDLE,
payload: {
list,
},
});
export default {
createListInCurrentBoard,
handleListCreate,
updateList,
handleListUpdate,
moveList,
deleteList,
handleListDelete,
};

View File

@@ -0,0 +1,18 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const authenticate = (data) => ({
type: EntryActionTypes.AUTHENTICATE,
payload: {
data,
},
});
const clearAuthenticateError = () => ({
type: EntryActionTypes.AUTHENTICATE_ERROR_CLEAR,
payload: {},
});
export default {
authenticate,
clearAuthenticateError,
};

View File

@@ -0,0 +1,43 @@
import EntryActionTypes from '../constants/EntryActionTypes';
import ModalTypes from '../constants/ModalTypes';
const openUsersModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.USERS,
},
});
const openUserSettingsModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.USER_SETTINGS,
},
});
const openProjectAddModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.PROJECT_ADD,
},
});
const openProjectSettingsModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.PROJECT_SETTINGS,
},
});
const closeModal = () => ({
type: EntryActionTypes.MODAL_CLOSE,
payload: {},
});
export default {
openUsersModal,
openUserSettingsModal,
openProjectAddModal,
openProjectSettingsModal,
closeModal,
};

View File

@@ -0,0 +1,28 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const handleNotificationCreate = (notification) => ({
type: EntryActionTypes.NOTIFICATION_CREATE_HANDLE,
payload: {
notification,
},
});
const deleteNotification = (id) => ({
type: EntryActionTypes.NOTIFICATION_DELETE,
payload: {
id,
},
});
const handleNotificationDelete = (notification) => ({
type: EntryActionTypes.NOTIFICATION_DELETE_HANDLE,
payload: {
notification,
},
});
export default {
handleNotificationCreate,
deleteNotification,
handleNotificationDelete,
};

View File

@@ -0,0 +1,36 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createManagerInCurrentProject = (data) => ({
type: EntryActionTypes.MANAGER_IN_CURRENT_PROJECT_CREATE,
payload: {
data,
},
});
const handleProjectManagerCreate = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
payload: {
projectManager,
},
});
const deleteProjectManager = (id) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE,
payload: {
id,
},
});
const handleProjectManagerDelete = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
payload: {
projectManager,
},
});
export default {
createManagerInCurrentProject,
handleProjectManagerCreate,
deleteProjectManager,
handleProjectManagerDelete,
};

View File

@@ -0,0 +1,58 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createProject = (data) => ({
type: EntryActionTypes.PROJECT_CREATE,
payload: {
data,
},
});
const handleProjectCreate = (project) => ({
type: EntryActionTypes.PROJECT_CREATE_HANDLE,
payload: {
project,
},
});
const updateCurrentProject = (data) => ({
type: EntryActionTypes.CURRENT_PROJECT_UPDATE,
payload: {
data,
},
});
const handleProjectUpdate = (project) => ({
type: EntryActionTypes.PROJECT_UPDATE_HANDLE,
payload: {
project,
},
});
const updateCurrentProjectBackgroundImage = (data) => ({
type: EntryActionTypes.CURRENT_PROJECT_BACKGROUND_IMAGE_UPDATE,
payload: {
data,
},
});
const deleteCurrentProject = () => ({
type: EntryActionTypes.CURRENT_PROJECT_DELETE,
payload: {},
});
const handleProjectDelete = (project) => ({
type: EntryActionTypes.PROJECT_DELETE_HANDLE,
payload: {
project,
},
});
export default {
createProject,
handleProjectCreate,
updateCurrentProject,
handleProjectUpdate,
updateCurrentProjectBackgroundImage,
deleteCurrentProject,
handleProjectDelete,
};

View File

@@ -0,0 +1,16 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const handleSocketDisconnect = () => ({
type: EntryActionTypes.SOCKET_DISCONNECT_HANDLE,
payload: {},
});
const handleSocketReconnect = () => ({
type: EntryActionTypes.SOCKET_RECONNECT_HANDLE,
payload: {},
});
export default {
handleSocketDisconnect,
handleSocketReconnect,
};

View File

@@ -0,0 +1,62 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createTaskInCurrentCard = (data) => ({
type: EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
const handleTaskCreate = (task) => ({
type: EntryActionTypes.TASK_CREATE_HANDLE,
payload: {
task,
},
});
const updateTask = (id, data) => ({
type: EntryActionTypes.TASK_UPDATE,
payload: {
id,
data,
},
});
const handleTaskUpdate = (task) => ({
type: EntryActionTypes.TASK_UPDATE_HANDLE,
payload: {
task,
},
});
const moveTask = (id, index) => ({
type: EntryActionTypes.TASK_MOVE,
payload: {
id,
index,
},
});
const deleteTask = (id) => ({
type: EntryActionTypes.TASK_DELETE,
payload: {
id,
},
});
const handleTaskDelete = (task) => ({
type: EntryActionTypes.TASK_DELETE_HANDLE,
payload: {
task,
},
});
export default {
createTaskInCurrentCard,
handleTaskCreate,
updateTask,
handleTaskUpdate,
moveTask,
deleteTask,
handleTaskDelete,
};

242
client/src/entry-actions/users.js Executable file
View File

@@ -0,0 +1,242 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createUser = (data) => ({
type: EntryActionTypes.USER_CREATE,
payload: {
data,
},
});
const handleUserCreate = (user) => ({
type: EntryActionTypes.USER_CREATE_HANDLE,
payload: {
user,
},
});
const clearUserCreateError = () => ({
type: EntryActionTypes.USER_CREATE_ERROR_CLEAR,
payload: {},
});
const updateUser = (id, data) => ({
type: EntryActionTypes.USER_UPDATE,
payload: {
id,
data,
},
});
const updateCurrentUser = (data) => ({
type: EntryActionTypes.CURRENT_USER_UPDATE,
payload: {
data,
},
});
const handleUserUpdate = (user) => ({
type: EntryActionTypes.USER_UPDATE_HANDLE,
payload: {
user,
},
});
const updateCurrentUserLanguage = (language) => ({
type: EntryActionTypes.CURRENT_USER_LANGUAGE_UPDATE,
payload: {
language,
},
});
const updateUserEmail = (id, data) => ({
type: EntryActionTypes.USER_EMAIL_UPDATE,
payload: {
id,
data,
},
});
const updateCurrentUserEmail = (data) => ({
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE,
payload: {
data,
},
});
const clearUserEmailUpdateError = (id) => ({
type: EntryActionTypes.USER_EMAIL_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
const clearCurrentUserEmailUpdateError = () => ({
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR,
payload: {},
});
const updateUserPassword = (id, data) => ({
type: EntryActionTypes.USER_PASSWORD_UPDATE,
payload: {
id,
data,
},
});
const updateCurrentUserPassword = (data) => ({
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE,
payload: {
data,
},
});
const clearUserPasswordUpdateError = (id) => ({
type: EntryActionTypes.USER_PASSWORD_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
const clearCurrentUserPasswordUpdateError = () => ({
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR,
payload: {},
});
const updateUserUsername = (id, data) => ({
type: EntryActionTypes.USER_USERNAME_UPDATE,
payload: {
id,
data,
},
});
const updateCurrentUserUsername = (data) => ({
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE,
payload: {
data,
},
});
const clearUserUsernameUpdateError = (id) => ({
type: EntryActionTypes.USER_USERNAME_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
const clearCurrentUserUsernameUpdateError = () => ({
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR,
payload: {},
});
const updateCurrentUserAvatar = (data) => ({
type: EntryActionTypes.CURRENT_USER_AVATAR_UPDATE,
payload: {
data,
},
});
const deleteUser = (id) => ({
type: EntryActionTypes.USER_DELETE,
payload: {
id,
},
});
const handleUserDelete = (user) => ({
type: EntryActionTypes.USER_DELETE_HANDLE,
payload: {
user,
},
});
const addUserToCard = (id, cardId) => ({
type: EntryActionTypes.USER_TO_CARD_ADD,
payload: {
id,
cardId,
},
});
const addUserToCurrentCard = (id) => ({
type: EntryActionTypes.USER_TO_CURRENT_CARD_ADD,
payload: {
id,
},
});
const handleUserToCardAdd = (cardMembership) => ({
type: EntryActionTypes.USER_TO_CARD_ADD_HANDLE,
payload: {
cardMembership,
},
});
const removeUserFromCard = (id, cardId) => ({
type: EntryActionTypes.USER_FROM_CARD_REMOVE,
payload: {
id,
cardId,
},
});
const removeUserFromCurrentCard = (id) => ({
type: EntryActionTypes.USER_FROM_CURRENT_CARD_REMOVE,
payload: {
id,
},
});
const handleUserFromCardRemove = (cardMembership) => ({
type: EntryActionTypes.USER_FROM_CARD_REMOVE_HANDLE,
payload: {
cardMembership,
},
});
const addUserToFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.USER_TO_FILTER_IN_CURRENT_BOARD_ADD,
payload: {
id,
},
});
const removeUserFromFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE,
payload: {
id,
},
});
export default {
createUser,
handleUserCreate,
clearUserCreateError,
updateUser,
updateCurrentUser,
handleUserUpdate,
updateCurrentUserLanguage,
updateUserEmail,
updateCurrentUserEmail,
clearUserEmailUpdateError,
clearCurrentUserEmailUpdateError,
updateUserPassword,
updateCurrentUserPassword,
clearUserPasswordUpdateError,
clearCurrentUserPasswordUpdateError,
updateUserUsername,
updateCurrentUserUsername,
clearUserUsernameUpdateError,
clearCurrentUserUsernameUpdateError,
updateCurrentUserAvatar,
deleteUser,
handleUserDelete,
addUserToCard,
addUserToCurrentCard,
handleUserToCardAdd,
removeUserFromCard,
removeUserFromCurrentCard,
handleUserFromCardRemove,
addUserToFilterInCurrentBoard,
removeUserFromFilterInCurrentBoard,
};