Implemented legacy method to send email even if there is no integration
This commit is contained in:
parent
9b4cf088c0
commit
3366a05c1d
1 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@ import async from 'async';
|
||||||
import {v5 as uuidv5} from 'uuid';
|
import {v5 as uuidv5} from 'uuid';
|
||||||
import short from 'short-uuid';
|
import short from 'short-uuid';
|
||||||
import {createMeeting, updateMeeting} from "../../../lib/videoClient";
|
import {createMeeting, updateMeeting} from "../../../lib/videoClient";
|
||||||
|
import EventAttendeeMail from "../../../lib/emails/EventAttendeeMail";
|
||||||
|
|
||||||
const translator = short();
|
const translator = short();
|
||||||
|
|
||||||
|
@ -139,6 +140,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
// TODO Should just be set to the true case as soon as we have a "bare email" integration class.
|
// TODO Should just be set to the true case as soon as we have a "bare email" integration class.
|
||||||
// UID generation should happen in the integration itself, not here.
|
// UID generation should happen in the integration itself, not here.
|
||||||
const hashUID = results.length > 0 ? results[0].response.uid : translator.fromUUID(uuidv5(JSON.stringify(evt), uuidv5.URL));
|
const hashUID = results.length > 0 ? results[0].response.uid : translator.fromUUID(uuidv5(JSON.stringify(evt), uuidv5.URL));
|
||||||
|
if(results.length === 0) {
|
||||||
|
// Legacy as well, as soon as we have a separate email integration class. Just used
|
||||||
|
// to send an email even if there is no integration at all.
|
||||||
|
const mail = new EventAttendeeMail(evt, hashUID);
|
||||||
|
await mail.sendEmail();
|
||||||
|
}
|
||||||
|
|
||||||
await prisma.booking.create({
|
await prisma.booking.create({
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Reference in a new issue