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-list-to-project-path.js

34 lines
538 B
JavaScript
Executable file

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