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

34 lines
562 B
JavaScript
Executable file

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