mirror of
https://github.com/plankanban/planka.git
synced 2025-07-25 16:19:47 +02:00
parent
ad7fb51cfa
commit
2ee1166747
1557 changed files with 76832 additions and 47042 deletions
|
@ -1,11 +1,30 @@
|
|||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import omit from 'lodash/omit';
|
||||
|
||||
import socket from './socket';
|
||||
import { transformCard } from './cards';
|
||||
import { transformAttachment } from './attachments';
|
||||
import { transformActivity } from './activities';
|
||||
|
||||
/* Actions */
|
||||
|
||||
const createList = (boardId, data, headers) =>
|
||||
socket.post(`/boards/${boardId}/lists`, data, headers);
|
||||
|
||||
const getList = (id, headers) =>
|
||||
socket.get(`/lists/${id}`, undefined, headers).then((body) => ({
|
||||
...body,
|
||||
included: {
|
||||
...body.included,
|
||||
cards: body.included.cards.map(transformCard),
|
||||
attachments: body.included.attachments.map(transformAttachment),
|
||||
},
|
||||
}));
|
||||
|
||||
const updateList = (id, data, headers) => socket.patch(`/lists/${id}`, data, headers);
|
||||
|
||||
const sortList = (id, data, headers) =>
|
||||
|
@ -17,11 +36,30 @@ const sortList = (id, data, headers) =>
|
|||
},
|
||||
}));
|
||||
|
||||
const deleteList = (id, headers) => socket.delete(`/lists/${id}`, undefined, headers);
|
||||
const moveListCards = (id, data, headers) =>
|
||||
socket.post(`/lists/${id}/move-cards`, data, headers).then((body) => ({
|
||||
...body,
|
||||
included: {
|
||||
...omit(body.included, 'actions'),
|
||||
cards: body.included.cards.map(transformCard),
|
||||
activities: body.included.actions.map(transformActivity),
|
||||
},
|
||||
}));
|
||||
|
||||
const clearList = (id, headers) => socket.post(`/lists/${id}/clear`, undefined, headers);
|
||||
|
||||
const deleteList = (id, headers) =>
|
||||
socket.delete(`/lists/${id}`, undefined, headers).then((body) => ({
|
||||
...body,
|
||||
included: {
|
||||
...body.included,
|
||||
cards: body.included.cards.map(transformCard),
|
||||
},
|
||||
}));
|
||||
|
||||
/* Event handlers */
|
||||
|
||||
const makeHandleListSort = (next) => (body) => {
|
||||
const makeHandleListDelete = (next) => (body) => {
|
||||
next({
|
||||
...body,
|
||||
included: {
|
||||
|
@ -33,8 +71,11 @@ const makeHandleListSort = (next) => (body) => {
|
|||
|
||||
export default {
|
||||
createList,
|
||||
getList,
|
||||
updateList,
|
||||
sortList,
|
||||
moveListCards,
|
||||
clearList,
|
||||
deleteList,
|
||||
makeHandleListSort,
|
||||
makeHandleListDelete,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue