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 nodemailer from "nodemailer";
|
||||
|
||||
interface EntryPoint {
|
||||
export interface EntryPoint {
|
||||
entryPointType?: string;
|
||||
uri?: string;
|
||||
label?: string;
|
||||
|
@ -15,7 +15,7 @@ interface EntryPoint {
|
|||
password?: string;
|
||||
}
|
||||
|
||||
interface AdditionInformation {
|
||||
export interface AdditionInformation {
|
||||
conferenceData?: ConferenceData;
|
||||
entryPoints?: EntryPoint[];
|
||||
hangoutLink?: string;
|
||||
|
@ -34,6 +34,7 @@ export default abstract class EventMail {
|
|||
*
|
||||
* @param calEvent
|
||||
* @param uid
|
||||
* @param additionInformation
|
||||
*/
|
||||
constructor(calEvent: CalendarEvent, uid: string, additionInformation: AdditionInformation = null) {
|
||||
this.calEvent = calEvent;
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
import {CalendarEvent} from "../calendarClient";
|
||||
import { CalendarEvent } from "../calendarClient";
|
||||
import EventAttendeeMail from "./EventAttendeeMail";
|
||||
import {getFormattedMeetingId, getIntegrationName} from "./helpers";
|
||||
import {VideoCallData} from "../videoClient";
|
||||
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
|
||||
import { VideoCallData } from "../videoClient";
|
||||
import { AdditionInformation } from "@lib/emails/EventMail";
|
||||
|
||||
export default class VideoEventAttendeeMail extends EventAttendeeMail {
|
||||
videoCallData: VideoCallData;
|
||||
|
||||
constructor(calEvent: CalendarEvent, uid: string, videoCallData: VideoCallData) {
|
||||
constructor(
|
||||
calEvent: CalendarEvent,
|
||||
uid: string,
|
||||
videoCallData: VideoCallData,
|
||||
additionInformation: AdditionInformation = null
|
||||
) {
|
||||
super(calEvent, uid);
|
||||
this.videoCallData = videoCallData;
|
||||
this.additionInformation = additionInformation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,4 +31,4 @@ export default class VideoEventAttendeeMail extends EventAttendeeMail {
|
|||
<strong>Meeting URL:</strong> <a href="${this.videoCallData.url}">${this.videoCallData.url}</a><br />
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,20 @@ import { CalendarEvent } from "../calendarClient";
|
|||
import EventOrganizerMail from "./EventOrganizerMail";
|
||||
import { VideoCallData } from "../videoClient";
|
||||
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
|
||||
import { AdditionInformation } from "@lib/emails/EventMail";
|
||||
|
||||
export default class VideoEventOrganizerMail extends EventOrganizerMail {
|
||||
videoCallData: VideoCallData;
|
||||
|
||||
constructor(calEvent: CalendarEvent, uid: string, videoCallData: VideoCallData) {
|
||||
constructor(
|
||||
calEvent: CalendarEvent,
|
||||
uid: string,
|
||||
videoCallData: VideoCallData,
|
||||
additionInformation: AdditionInformation = null
|
||||
) {
|
||||
super(calEvent, uid);
|
||||
this.videoCallData = videoCallData;
|
||||
this.additionInformation = additionInformation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,8 @@ import EventAttendeeRescheduledMail from "./emails/EventAttendeeRescheduledMail"
|
|||
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
|
||||
import { EventResult } from "@lib/events/EventManager";
|
||||
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"] });
|
||||
|
||||
|
@ -224,8 +226,19 @@ const createMeeting = async (credential, calEvent: CalendarEvent): Promise<Event
|
|||
url: creationResult.join_url,
|
||||
};
|
||||
|
||||
const organizerMail = new VideoEventOrganizerMail(calEvent, uid, videoCallData);
|
||||
const attendeeMail = new VideoEventAttendeeMail(calEvent, uid, videoCallData);
|
||||
const entryPoint: EntryPoint = {
|
||||
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 {
|
||||
await organizerMail.sendEmail();
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue