You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
589 B
JavaScript
30 lines
589 B
JavaScript
const idOrIdsValidator = (value) => _.isString(value) || _.every(value, _.isString);
|
|
|
|
module.exports = {
|
|
inputs: {
|
|
idOrIds: {
|
|
type: 'json',
|
|
custom: idOrIdsValidator,
|
|
required: true,
|
|
},
|
|
exceptUserIdOrIds: {
|
|
type: 'json',
|
|
custom: idOrIdsValidator,
|
|
},
|
|
},
|
|
|
|
async fn(inputs) {
|
|
const criteria = {
|
|
cardId: inputs.idOrIds,
|
|
};
|
|
|
|
if (!_.isUndefined(inputs.exceptUserIdOrIds)) {
|
|
criteria.userId = {
|
|
'!=': inputs.exceptUserIdOrIds,
|
|
};
|
|
}
|
|
|
|
return sails.helpers.cardSubscriptions.getMany(criteria);
|
|
},
|
|
};
|