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/get-task-to-project-path.js
2020-04-03 00:35:25 +05:00

34 lines
554 B
JavaScript
Executable file

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