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

34 lines
534 B
JavaScript

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