mirror of
https://github.com/plankanban/planka.git
synced 2025-12-17 17:23:25 +03:00
Initial commit
This commit is contained in:
30
server/api/helpers/get-actions-for-card.js
Normal file
30
server/api/helpers/get-actions-for-card.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const LIMIT = 10;
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
id: {
|
||||
type: 'json',
|
||||
custom: value => _.isInteger(value) || _.isArray(value),
|
||||
required: true
|
||||
},
|
||||
beforeId: {
|
||||
type: 'number'
|
||||
}
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user