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.
planka_custom/server/api/helpers/cards/get-subscription-user-ids.js

25 lines
571 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 cardSubscriptions = await sails.helpers.cards.getCardSubscriptions(
inputs.idOrIds,
inputs.exceptUserIdOrIds,
);
return sails.helpers.utils.mapRecords(cardSubscriptions, 'userId', _.isArray(inputs.idOrIds));
},
};