mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
Add covers for cards
This commit is contained in:
parent
f743f4ea8b
commit
3dffed90c6
26 changed files with 315 additions and 98 deletions
|
@ -4,6 +4,10 @@ module.exports = {
|
|||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
values: {
|
||||
type: 'json',
|
||||
required: true,
|
||||
|
@ -17,6 +21,7 @@ module.exports = {
|
|||
const attachment = await Attachment.create({
|
||||
...inputs.values,
|
||||
cardId: inputs.card.id,
|
||||
userId: inputs.user.id,
|
||||
}).fetch();
|
||||
|
||||
sails.sockets.broadcast(
|
||||
|
@ -28,6 +33,16 @@ module.exports = {
|
|||
inputs.request,
|
||||
);
|
||||
|
||||
if (!inputs.card.coverAttachmentId && attachment.isImage) {
|
||||
await sails.helpers.updateCard.with({
|
||||
record: inputs.card,
|
||||
values: {
|
||||
coverAttachmentId: attachment.id,
|
||||
},
|
||||
request: inputs.request,
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(attachment);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue