mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 21:29:43 +02:00
35 lines
590 B
JavaScript
35 lines
590 B
JavaScript
|
module.exports = {
|
||
|
inputs: {
|
||
|
criteria: {
|
||
|
type: 'json',
|
||
|
required: true,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
exits: {
|
||
|
pathNotFound: {},
|
||
|
},
|
||
|
|
||
|
async fn(inputs, exits) {
|
||
|
const attachment = await Attachment.findOne(inputs.criteria);
|
||
|
|
||
|
if (!attachment) {
|
||
|
throw 'pathNotFound';
|
||
|
}
|
||
|
|
||
|
const path = await sails.helpers
|
||
|
.getCardToProjectPath(attachment.cardId)
|
||
|
.intercept('pathNotFound', (nodes) => ({
|
||
|
pathNotFound: {
|
||
|
attachment,
|
||
|
...nodes,
|
||
|
},
|
||
|
}));
|
||
|
|
||
|
return exits.success({
|
||
|
attachment,
|
||
|
...path,
|
||
|
});
|
||
|
},
|
||
|
};
|