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,
|
|
|
|
},
|
|
|
|
exceptUserIdOrIds: {
|
|
|
|
type: 'json',
|
2022-12-26 21:10:50 +01:00
|
|
|
custom: idOrIdsValidator,
|
2021-06-24 01:05:22 +05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
async fn(inputs) {
|
|
|
|
const cardSubscriptions = await sails.helpers.cards.getCardSubscriptions(
|
|
|
|
inputs.idOrIds,
|
|
|
|
inputs.exceptUserIdOrIds,
|
|
|
|
);
|
|
|
|
|
|
|
|
return sails.helpers.utils.mapRecords(cardSubscriptions, 'userId', _.isArray(inputs.idOrIds));
|
|
|
|
},
|
|
|
|
};
|