1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/helpers/cards/get-project-path.js
2022-12-26 21:10:50 +01:00

34 lines
532 B
JavaScript

module.exports = {
inputs: {
criteria: {
type: 'json',
required: true,
},
},
exits: {
pathNotFound: {},
},
async fn(inputs) {
const card = await Card.findOne(inputs.criteria);
if (!card) {
throw 'pathNotFound';
}
const path = await sails.helpers.lists
.getProjectPath(card.listId)
.intercept('pathNotFound', (nodes) => ({
pathNotFound: {
card,
...nodes,
},
}));
return {
card,
...path,
};
},
};