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.
planka_custom/server/api/helpers/get-card-to-project-path.js

35 lines
537 B
JavaScript

module.exports = {
inputs: {
criteria: {
type: 'json',
required: true
}
},
exits: {
notFound: {}
},
fn: async function(inputs, exits) {
const card = await Card.findOne(inputs.criteria);
if (!card) {
throw 'notFound';
}
const path = await sails.helpers
.getListToProjectPath(card.listId)
.intercept('notFound', path => ({
notFound: {
card,
...path
}
}));
return exits.success({
card,
...path
});
}
};