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/actions/get-project-path.js

34 lines
544 B
JavaScript

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