2022-12-26 21:10:50 +01:00
|
|
|
const idOrIdsValidator = (value) => _.isString(value) || _.every(value, _.isString);
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
|
|
|
idOrIds: {
|
|
|
|
type: 'json',
|
2022-12-26 21:10:50 +01:00
|
|
|
custom: idOrIdsValidator,
|
2021-06-24 01:05:22 +05:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
exceptCardIdOrIds: {
|
|
|
|
type: 'json',
|
2022-12-26 21:10:50 +01:00
|
|
|
custom: idOrIdsValidator,
|
2021-06-24 01:05:22 +05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
async fn(inputs) {
|
|
|
|
const criteria = {
|
|
|
|
listId: inputs.idOrIds,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!_.isUndefined(inputs.exceptCardIdOrIds)) {
|
|
|
|
criteria.id = {
|
|
|
|
'!=': inputs.exceptCardIdOrIds,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-12-26 21:10:50 +01:00
|
|
|
return sails.helpers.cards.getMany(criteria);
|
2021-06-24 01:05:22 +05:00
|
|
|
},
|
|
|
|
};
|