2019-08-31 04:07:25 +05:00
|
|
|
const LIMIT = 10;
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
2021-06-24 01:05:22 +05:00
|
|
|
idOrIds: {
|
2019-08-31 04:07:25 +05:00
|
|
|
type: 'json',
|
2021-06-24 01:05:22 +05:00
|
|
|
custom: (value) => _.isString(value) || _.every(value, _.isString),
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
beforeId: {
|
2019-11-05 18:01:42 +05:00
|
|
|
type: 'string',
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
async fn(inputs) {
|
2019-08-31 04:07:25 +05:00
|
|
|
const criteria = {
|
2021-06-24 01:05:22 +05:00
|
|
|
cardId: inputs.idOrIds,
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!_.isUndefined(inputs.beforeId)) {
|
|
|
|
criteria.id = {
|
2019-11-05 18:01:42 +05:00
|
|
|
'<': inputs.beforeId,
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
return sails.helpers.actions.getMany(criteria, LIMIT);
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|