mirror of
https://github.com/plankanban/planka.git
synced 2025-07-24 23:59:48 +02:00
41 lines
1.2 KiB
JavaScript
Executable file
41 lines
1.2 KiB
JavaScript
Executable file
/*!
|
|
* Copyright (c) 2024 PLANKA Software GmbH
|
|
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
|
*/
|
|
|
|
import http from './http';
|
|
import socket from './socket';
|
|
import { transformCard } from './cards';
|
|
import { transformAttachment } from './attachments';
|
|
|
|
/* Actions */
|
|
|
|
const createBoard = (projectId, data, headers) =>
|
|
socket.post(`/projects/${projectId}/boards`, data, headers);
|
|
|
|
const createBoardWithImport = (projectId, data, requestId, headers) =>
|
|
http.post(`/projects/${projectId}/boards?requestId=${requestId}`, data, headers);
|
|
|
|
const getBoard = (id, subscribe, headers) =>
|
|
socket
|
|
.get(`/boards/${id}${subscribe ? '?subscribe=true' : ''}`, undefined, headers)
|
|
.then((body) => ({
|
|
...body,
|
|
included: {
|
|
...body.included,
|
|
cards: body.included.cards.map(transformCard),
|
|
attachments: body.included.attachments.map(transformAttachment),
|
|
},
|
|
}));
|
|
|
|
const updateBoard = (id, data, headers) => socket.patch(`/boards/${id}`, data, headers);
|
|
|
|
const deleteBoard = (id, headers) => socket.delete(`/boards/${id}`, undefined, headers);
|
|
|
|
export default {
|
|
createBoard,
|
|
createBoardWithImport,
|
|
getBoard,
|
|
updateBoard,
|
|
deleteBoard,
|
|
};
|