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

34 lines
556 B
JavaScript
Executable file

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