2021-09-24 23:09:20 +00:00
|
|
|
import { Queue } from "quirrel/blitz";
|
|
|
|
|
2021-10-13 19:42:23 +00:00
|
|
|
import appLogger from "integrations/logger";
|
|
|
|
import { sendEmail } from "integrations/aws-ses";
|
2021-09-24 23:09:20 +00:00
|
|
|
|
|
|
|
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: "",
|
|
|
|
body: "",
|
|
|
|
}),
|
|
|
|
sendEmail({
|
|
|
|
recipients: [newEmail],
|
|
|
|
subject: "",
|
|
|
|
body: "",
|
|
|
|
}),
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default notifyEmailChangeQueue;
|