1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00
planka/server/api/helpers/board-memberships/get-project-path.js

35 lines
600 B
JavaScript
Raw Normal View History

2020-04-21 05:04:34 +05:00
module.exports = {
inputs: {
criteria: {
type: 'json',
required: true,
},
},
exits: {
pathNotFound: {},
},
async fn(inputs) {
const boardMembership = await BoardMembership.findOne(inputs.criteria);
2020-04-21 05:04:34 +05:00
if (!boardMembership) {
2020-04-21 05:04:34 +05:00
throw 'pathNotFound';
}
const path = await sails.helpers.boards
.getProjectPath(boardMembership.boardId)
2020-04-21 05:04:34 +05:00
.intercept('pathNotFound', (nodes) => ({
pathNotFound: {
boardMembership,
2020-04-21 05:04:34 +05:00
...nodes,
},
}));
return {
boardMembership,
2020-04-21 05:04:34 +05:00
...path,
};
2020-04-21 05:04:34 +05:00
},
};