mirror of
https://github.com/plankanban/planka.git
synced 2025-07-21 14:19:44 +02:00
Project managers, board members, auto-update after reconnection, refactoring
This commit is contained in:
parent
d6cb1f6683
commit
b39119ace4
478 changed files with 21226 additions and 19495 deletions
|
@ -1,54 +0,0 @@
|
|||
module.exports = {
|
||||
inputs: {
|
||||
card: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
},
|
||||
requestId: {
|
||||
type: 'string',
|
||||
isNotEmptyString: true,
|
||||
allowNull: true,
|
||||
defaultsTo: null,
|
||||
},
|
||||
request: {
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
const attachment = await Attachment.create({
|
||||
...inputs.values,
|
||||
cardId: inputs.card.id,
|
||||
userId: inputs.user.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
`board:${inputs.card.boardId}`,
|
||||
'attachmentCreate',
|
||||
{
|
||||
item: attachment,
|
||||
requestId: inputs.requestId,
|
||||
},
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
if (!inputs.card.coverAttachmentId && attachment.isImage) {
|
||||
await sails.helpers.updateCard.with({
|
||||
record: inputs.card,
|
||||
values: {
|
||||
coverAttachmentId: attachment.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(attachment);
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue