1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00
planka/server/api/helpers/get-action-to-project-path.js

34 lines
550 B
JavaScript
Executable file

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