feat: Version 2

Closes #627, closes #1047
This commit is contained in:
Maksim Eltyshev
2025-05-10 02:09:06 +02:00
parent ad7fb51cfa
commit 2ee1166747
1557 changed files with 76832 additions and 47042 deletions
+26 -3
View File
@@ -1,3 +1,8 @@
/*!
* 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';
@@ -5,17 +10,34 @@ import socket from './socket';
export const transformAttachment = (attachment) => ({
...attachment,
createdAt: new Date(attachment.createdAt),
...(attachment.createdAt && {
createdAt: new Date(attachment.createdAt),
}),
});
/* Actions */
const createAttachment = (cardId, data, requestId, headers) =>
http.post(`/cards/${cardId}/attachments?requestId=${requestId}`, data, headers).then((body) => ({
const createAttachment = (cardId, data, headers) =>
socket.post(`/cards/${cardId}/attachments`, data, headers).then((body) => ({
...body,
item: transformAttachment(body.item),
}));
const createAttachmentWithFile = (cardId, { file, ...data }, requestId, headers) =>
http
.post(
`/cards/${cardId}/attachments?requestId=${requestId}`,
{
...data,
file,
},
headers,
)
.then((body) => ({
...body,
item: transformAttachment(body.item),
}));
const updateAttachment = (id, data, headers) =>
socket.patch(`/attachments/${id}`, data, headers).then((body) => ({
...body,
@@ -43,6 +65,7 @@ const makeHandleAttachmentDelete = makeHandleAttachmentCreate;
export default {
createAttachment,
createAttachmentWithFile,
updateAttachment,
deleteAttachment,
makeHandleAttachmentCreate,