You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
549 B
JavaScript
35 lines
549 B
JavaScript
module.exports = {
|
|
inputs: {
|
|
criteria: {
|
|
type: 'json',
|
|
required: true
|
|
}
|
|
},
|
|
|
|
exits: {
|
|
notFound: {}
|
|
},
|
|
|
|
fn: async function(inputs, exits) {
|
|
const action = await Action.findOne(inputs.criteria);
|
|
|
|
if (!action) {
|
|
throw 'notFound';
|
|
}
|
|
|
|
const path = await sails.helpers
|
|
.getCardToProjectPath(action.cardId)
|
|
.intercept('notFound', path => ({
|
|
notFound: {
|
|
action,
|
|
...path
|
|
}
|
|
}));
|
|
|
|
return exits.success({
|
|
action,
|
|
...path
|
|
});
|
|
}
|
|
};
|