filter mass mails

pull/557/head
Ran Shamay 2 years ago
parent 6bfe13bb3d
commit b2c7371913

@ -79,7 +79,7 @@ module.exports = {
request: this.req,
})
.intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER);
await sendUserEmails({ to: [inputs.userId], subject: 'b', text: 'c' });
await sendUserEmails({ to: [inputs.userId], subject: 'משימה חדשה ניתנה', text: 'c' });
return {
item: cardMembership,
};

@ -28,8 +28,8 @@ const sendEmail = async ({ to, subject, text, cc }) => {
}
};
const sendUserEmails = async ({ ids, subject, text, cc }) => {
const users = await sails.helpers.users.getMany(ids);
const sendUserEmails = async ({ to, subject, text, cc }) => {
const users = await sails.helpers.users.getMany({ id: { in: to } });
return sendEmail({ to: users.map((u) => u.email), subject, text, cc });
};

Loading…
Cancel
Save