Use entrypoint to make zoom location more beautiful
This commit is contained in:
parent
da64dae568
commit
cf52df5662
4 changed files with 38 additions and 10 deletions
|
@ -4,7 +4,7 @@ import { CalendarEvent, ConferenceData } from "../calendarClient";
|
||||||
import { serverConfig } from "../serverConfig";
|
import { serverConfig } from "../serverConfig";
|
||||||
import nodemailer from "nodemailer";
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
interface EntryPoint {
|
export interface EntryPoint {
|
||||||
entryPointType?: string;
|
entryPointType?: string;
|
||||||
uri?: string;
|
uri?: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
|
@ -15,7 +15,7 @@ interface EntryPoint {
|
||||||
password?: string;
|
password?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdditionInformation {
|
export interface AdditionInformation {
|
||||||
conferenceData?: ConferenceData;
|
conferenceData?: ConferenceData;
|
||||||
entryPoints?: EntryPoint[];
|
entryPoints?: EntryPoint[];
|
||||||
hangoutLink?: string;
|
hangoutLink?: string;
|
||||||
|
@ -34,6 +34,7 @@ export default abstract class EventMail {
|
||||||
*
|
*
|
||||||
* @param calEvent
|
* @param calEvent
|
||||||
* @param uid
|
* @param uid
|
||||||
|
* @param additionInformation
|
||||||
*/
|
*/
|
||||||
constructor(calEvent: CalendarEvent, uid: string, additionInformation: AdditionInformation = null) {
|
constructor(calEvent: CalendarEvent, uid: string, additionInformation: AdditionInformation = null) {
|
||||||
this.calEvent = calEvent;
|
this.calEvent = calEvent;
|
||||||
|
|
|
@ -2,13 +2,20 @@ import {CalendarEvent} from "../calendarClient";
|
||||||
import EventAttendeeMail from "./EventAttendeeMail";
|
import EventAttendeeMail from "./EventAttendeeMail";
|
||||||
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
|
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
|
||||||
import { VideoCallData } from "../videoClient";
|
import { VideoCallData } from "../videoClient";
|
||||||
|
import { AdditionInformation } from "@lib/emails/EventMail";
|
||||||
|
|
||||||
export default class VideoEventAttendeeMail extends EventAttendeeMail {
|
export default class VideoEventAttendeeMail extends EventAttendeeMail {
|
||||||
videoCallData: VideoCallData;
|
videoCallData: VideoCallData;
|
||||||
|
|
||||||
constructor(calEvent: CalendarEvent, uid: string, videoCallData: VideoCallData) {
|
constructor(
|
||||||
|
calEvent: CalendarEvent,
|
||||||
|
uid: string,
|
||||||
|
videoCallData: VideoCallData,
|
||||||
|
additionInformation: AdditionInformation = null
|
||||||
|
) {
|
||||||
super(calEvent, uid);
|
super(calEvent, uid);
|
||||||
this.videoCallData = videoCallData;
|
this.videoCallData = videoCallData;
|
||||||
|
this.additionInformation = additionInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,13 +2,20 @@ import { CalendarEvent } from "../calendarClient";
|
||||||
import EventOrganizerMail from "./EventOrganizerMail";
|
import EventOrganizerMail from "./EventOrganizerMail";
|
||||||
import { VideoCallData } from "../videoClient";
|
import { VideoCallData } from "../videoClient";
|
||||||
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
|
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
|
||||||
|
import { AdditionInformation } from "@lib/emails/EventMail";
|
||||||
|
|
||||||
export default class VideoEventOrganizerMail extends EventOrganizerMail {
|
export default class VideoEventOrganizerMail extends EventOrganizerMail {
|
||||||
videoCallData: VideoCallData;
|
videoCallData: VideoCallData;
|
||||||
|
|
||||||
constructor(calEvent: CalendarEvent, uid: string, videoCallData: VideoCallData) {
|
constructor(
|
||||||
|
calEvent: CalendarEvent,
|
||||||
|
uid: string,
|
||||||
|
videoCallData: VideoCallData,
|
||||||
|
additionInformation: AdditionInformation = null
|
||||||
|
) {
|
||||||
super(calEvent, uid);
|
super(calEvent, uid);
|
||||||
this.videoCallData = videoCallData;
|
this.videoCallData = videoCallData;
|
||||||
|
this.additionInformation = additionInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,6 +8,8 @@ import EventAttendeeRescheduledMail from "./emails/EventAttendeeRescheduledMail"
|
||||||
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
|
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
|
||||||
import { EventResult } from "@lib/events/EventManager";
|
import { EventResult } from "@lib/events/EventManager";
|
||||||
import logger from "@lib/logger";
|
import logger from "@lib/logger";
|
||||||
|
import { AdditionInformation, EntryPoint } from "@lib/emails/EventMail";
|
||||||
|
import { getIntegrationName } from "@lib/emails/helpers";
|
||||||
|
|
||||||
const log = logger.getChildLogger({ prefix: ["[lib] videoClient"] });
|
const log = logger.getChildLogger({ prefix: ["[lib] videoClient"] });
|
||||||
|
|
||||||
|
@ -224,8 +226,19 @@ const createMeeting = async (credential, calEvent: CalendarEvent): Promise<Event
|
||||||
url: creationResult.join_url,
|
url: creationResult.join_url,
|
||||||
};
|
};
|
||||||
|
|
||||||
const organizerMail = new VideoEventOrganizerMail(calEvent, uid, videoCallData);
|
const entryPoint: EntryPoint = {
|
||||||
const attendeeMail = new VideoEventAttendeeMail(calEvent, uid, videoCallData);
|
entryPointType: getIntegrationName(videoCallData),
|
||||||
|
uri: videoCallData.url,
|
||||||
|
label: "Enter Meeting",
|
||||||
|
pin: videoCallData.password,
|
||||||
|
};
|
||||||
|
|
||||||
|
const additionInformation: AdditionInformation = {
|
||||||
|
entryPoints: [entryPoint],
|
||||||
|
};
|
||||||
|
|
||||||
|
const organizerMail = new VideoEventOrganizerMail(calEvent, uid, videoCallData, additionInformation);
|
||||||
|
const attendeeMail = new VideoEventAttendeeMail(calEvent, uid, videoCallData, additionInformation);
|
||||||
try {
|
try {
|
||||||
await organizerMail.sendEmail();
|
await organizerMail.sendEmail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue