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

35 lines
540 B
JavaScript

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