1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 21:29:43 +02:00
planka/server/api/helpers/get-board-to-project-path.js
2020-04-03 00:35:25 +05:00

35 lines
513 B
JavaScript
Executable file

module.exports = {
inputs: {
criteria: {
type: 'json',
required: true,
},
},
exits: {
pathNotFound: {},
},
async fn(inputs, exits) {
const board = await Board.findOne(inputs.criteria);
if (!board) {
throw 'pathNotFound';
}
const project = await Project.findOne(board.projectId);
if (!project) {
throw {
pathNotFound: {
board,
},
};
}
return exits.success({
board,
project,
});
},
};