Files
planka/client/src/actions/boards.js

179 lines
2.8 KiB
JavaScript
Raw Normal View History

/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
2019-08-31 04:07:25 +05:00
import ActionTypes from '../constants/ActionTypes';
2022-08-04 13:31:14 +02:00
const createBoard = (board) => ({
2019-08-31 04:07:25 +05:00
type: ActionTypes.BOARD_CREATE,
payload: {
board,
},
});
createBoard.success = (localId, board, boardMemberships) => ({
type: ActionTypes.BOARD_CREATE__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
localId,
board,
boardMemberships,
2019-08-31 04:07:25 +05:00
},
});
createBoard.failure = (localId, error) => ({
type: ActionTypes.BOARD_CREATE__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
localId,
error,
},
});
const handleBoardCreate = (board, boardMemberships) => ({
type: ActionTypes.BOARD_CREATE_HANDLE,
2019-08-31 04:07:25 +05:00
payload: {
board,
boardMemberships,
2019-08-31 04:07:25 +05:00
},
});
2022-08-04 13:31:14 +02:00
const fetchBoard = (id) => ({
type: ActionTypes.BOARD_FETCH,
2019-08-31 04:07:25 +05:00
payload: {
id,
},
});
fetchBoard.success = (
2019-08-31 04:07:25 +05:00
board,
users,
projects,
boardMemberships,
2019-08-31 04:07:25 +05:00
labels,
lists,
2019-08-31 04:07:25 +05:00
cards,
cardMemberships,
cardLabels,
taskLists,
2019-08-31 04:07:25 +05:00
tasks,
2020-04-21 05:04:34 +05:00
attachments,
customFieldGroups,
customFields,
customFieldValues,
2019-08-31 04:07:25 +05:00
) => ({
type: ActionTypes.BOARD_FETCH__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
board,
users,
projects,
boardMemberships,
2019-08-31 04:07:25 +05:00
labels,
lists,
2019-08-31 04:07:25 +05:00
cards,
cardMemberships,
cardLabels,
taskLists,
2019-08-31 04:07:25 +05:00
tasks,
2020-04-21 05:04:34 +05:00
attachments,
customFieldGroups,
customFields,
customFieldValues,
2019-08-31 04:07:25 +05:00
},
});
fetchBoard.failure = (id, error) => ({
type: ActionTypes.BOARD_FETCH__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
id,
error,
},
});
2022-08-04 13:31:14 +02:00
const updateBoard = (id, data) => ({
type: ActionTypes.BOARD_UPDATE,
2019-08-31 04:07:25 +05:00
payload: {
id,
data,
},
});
updateBoard.success = (board) => ({
type: ActionTypes.BOARD_UPDATE__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
board,
},
});
updateBoard.failure = (id, error) => ({
type: ActionTypes.BOARD_UPDATE__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
id,
error,
},
});
2022-08-04 13:31:14 +02:00
const handleBoardUpdate = (board) => ({
type: ActionTypes.BOARD_UPDATE_HANDLE,
2019-08-31 04:07:25 +05:00
payload: {
board,
},
});
const updateBoardContext = (id, value) => ({
type: ActionTypes.BOARD_CONTEXT_UPDATE,
payload: {
id,
value,
},
});
const searchInBoard = (id, value, currentListId) => ({
type: ActionTypes.IN_BOARD_SEARCH,
payload: {
id,
value,
currentListId,
},
});
2022-08-04 13:31:14 +02:00
const deleteBoard = (id) => ({
type: ActionTypes.BOARD_DELETE,
2019-08-31 04:07:25 +05:00
payload: {
id,
},
});
deleteBoard.success = (board) => ({
type: ActionTypes.BOARD_DELETE__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
board,
},
});
deleteBoard.failure = (id, error) => ({
type: ActionTypes.BOARD_DELETE__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
id,
error,
},
});
2022-08-04 13:31:14 +02:00
const handleBoardDelete = (board) => ({
type: ActionTypes.BOARD_DELETE_HANDLE,
2019-08-31 04:07:25 +05:00
payload: {
board,
},
});
2022-08-04 13:31:14 +02:00
export default {
createBoard,
handleBoardCreate,
fetchBoard,
updateBoard,
handleBoardUpdate,
updateBoardContext,
searchInBoard,
2022-08-04 13:31:14 +02:00
deleteBoard,
handleBoardDelete,
};