You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
planka_custom/server/api/helpers/lists/get-project-path.js

35 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,
};
},
};