2019-08-31 04:07:25 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
|
|
|
criteria: {
|
|
|
|
type: 'json',
|
2020-04-03 00:35:25 +05:00
|
|
|
custom: (value) => _.isArray(value) || _.isPlainObject(value),
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2020-08-04 01:32:46 +05:00
|
|
|
sort: {
|
|
|
|
type: 'json',
|
|
|
|
defaultsTo: 'id DESC',
|
|
|
|
},
|
|
|
|
limit: {
|
|
|
|
type: 'number',
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
|
2019-11-05 18:01:42 +05:00
|
|
|
async fn(inputs, exits) {
|
2020-08-04 01:32:46 +05:00
|
|
|
const cards = await Card.find(inputs.criteria).sort(inputs.sort).limit(inputs.limit);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
return exits.success(cards);
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|