2019-08-31 04:07:25 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
|
|
|
criteria: {
|
|
|
|
type: 'json',
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
|
|
|
|
exits: {
|
2020-04-03 00:35:25 +05:00
|
|
|
pathNotFound: {},
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
|
2019-11-05 18:01:42 +05:00
|
|
|
async fn(inputs, exits) {
|
2019-08-31 04:07:25 +05:00
|
|
|
const action = await Action.findOne(inputs.criteria);
|
|
|
|
|
|
|
|
if (!action) {
|
2020-04-03 00:35:25 +05:00
|
|
|
throw 'pathNotFound';
|
2019-08-31 04:07:25 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
const path = await sails.helpers
|
|
|
|
.getCardToProjectPath(action.cardId)
|
2020-04-03 00:35:25 +05:00
|
|
|
.intercept('pathNotFound', (nodes) => ({
|
|
|
|
pathNotFound: {
|
2019-08-31 04:07:25 +05:00
|
|
|
action,
|
2019-11-05 18:01:42 +05:00
|
|
|
...nodes,
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
}));
|
|
|
|
|
|
|
|
return exits.success({
|
|
|
|
action,
|
2019-11-05 18:01:42 +05:00
|
|
|
...path,
|
2019-08-31 04:07:25 +05:00
|
|
|
});
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|