1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00
planka/server/api/helpers/attachments/get-project-path.js

35 lines
568 B
JavaScript
Raw Normal View History

2020-04-21 05:04:34 +05:00
module.exports = {
inputs: {
criteria: {
type: 'json',
required: true,
},
},
exits: {
pathNotFound: {},
},
async fn(inputs) {
2020-04-21 05:04:34 +05:00
const attachment = await Attachment.findOne(inputs.criteria);
if (!attachment) {
throw 'pathNotFound';
}
const path = await sails.helpers.cards
.getProjectPath(attachment.cardId)
2020-04-21 05:04:34 +05:00
.intercept('pathNotFound', (nodes) => ({
pathNotFound: {
attachment,
...nodes,
},
}));
return {
2020-04-21 05:04:34 +05:00
attachment,
...path,
};
2020-04-21 05:04:34 +05:00
},
};