mirror of
https://github.com/plankanban/planka.git
synced 2025-12-17 17:23:25 +03:00
Initial commit
This commit is contained in:
35
server/api/helpers/get-board-to-project-path.js
Executable file
35
server/api/helpers/get-board-to-project-path.js
Executable file
@@ -0,0 +1,35 @@
|
||||
module.exports = {
|
||||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {}
|
||||
},
|
||||
|
||||
fn: async function(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
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user