Files
planka/server/api/helpers/get-board-to-project-path.js

36 lines
501 B
JavaScript
Executable File

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