shellphone.app/app/settings/api/queue/notify-email-change.ts

31 lines
625 B
TypeScript
Raw Normal View History

import { Queue } from "quirrel/blitz";
2021-10-13 19:42:23 +00:00
import appLogger from "integrations/logger";
import { sendEmail } from "integrations/aws-ses";
const logger = appLogger.child({ queue: "notify-email-change" });
type Payload = {
oldEmail: string;
newEmail: string;
};
const notifyEmailChangeQueue = Queue<Payload>("api/queue/notify-email-change", async ({ oldEmail, newEmail }) => {
await Promise.all([
sendEmail({
recipients: [oldEmail],
subject: "",
text: "",
html: "",
}),
sendEmail({
recipients: [newEmail],
subject: "",
text: "",
html: "",
}),
]);
});
export default notifyEmailChangeQueue;