1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/helpers/get-actions-for-card.js

31 lines
534 B
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
const LIMIT = 10;
module.exports = {
inputs: {
id: {
type: 'json',
custom: value => _.isString(value) || _.isArray(value),
2019-08-31 04:07:25 +05:00
required: true
},
beforeId: {
type: 'string'
2019-08-31 04:07:25 +05:00
}
},
fn: async function(inputs, exits) {
const criteria = {
cardId: inputs.id
};
if (!_.isUndefined(inputs.beforeId)) {
criteria.id = {
'<': inputs.beforeId
};
}
const actions = await sails.helpers.getActions(criteria, LIMIT);
return exits.success(actions);
}
};