mirror of
https://github.com/plankanban/planka.git
synced 2025-12-16 01:11:06 +03:00
Initial commit
This commit is contained in:
34
server/api/helpers/get-label-to-project-path.js
Executable file
34
server/api/helpers/get-label-to-project-path.js
Executable file
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
inputs: {
|
||||
criteria: {
|
||||
type: 'json',
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
exits: {
|
||||
notFound: {}
|
||||
},
|
||||
|
||||
fn: async function(inputs, exits) {
|
||||
const label = await Label.findOne(inputs.criteria);
|
||||
|
||||
if (!label) {
|
||||
throw 'notFound';
|
||||
}
|
||||
|
||||
const path = await sails.helpers
|
||||
.getBoardToProjectPath(label.boardId)
|
||||
.intercept('notFound', path => ({
|
||||
notFound: {
|
||||
label,
|
||||
...path
|
||||
}
|
||||
}));
|
||||
|
||||
return exits.success({
|
||||
label,
|
||||
...path
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user