Skip to content

Commit d9663df

Browse files
authored
Merge pull request #649 from xxcxy/fix-issues-593
fix 593 issue
2 parents b51b5f3 + ae8abaf commit d9663df

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/eventHandlers/InterviewEventHandler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ async function sendInterviewScheduledNotifications (payload) {
128128
const data = await notificationsSchedulerService.getDataForInterview(interviewEntity)
129129
if (!data) { return }
130130

131-
const { meeting, zoomAccountApiKey } = await generateZoomMeetingLink(interviewEntity.startTimestamp, interviewEntity.duration, interviewEntity.guestTimezone || interviewEntity.hostTimezone)
131+
const { meeting, zoomAccountApiKey } = await generateZoomMeetingLink(interviewEntity.startTimestamp, interviewEntity.duration)
132132

133133
const updatedInterview = await interviewEntity.update({ zoomAccountApiKey, zoomMeetingId: meeting.id })
134134
await processUpdateInterview(updatedInterview.toJSON())
@@ -259,7 +259,7 @@ async function sendInterviewRescheduledNotifications (payload) {
259259
const data = await notificationsSchedulerService.getDataForInterview(interviewEntity)
260260
if (!data) { return }
261261

262-
await updateZoomMeeting(interviewEntity.startTimestamp, interviewEntity.duration, interviewEntity.zoomAccountApiKey, interviewEntity.zoomMeetingId, interviewEntity.guestTimezone || interviewEntity.hostTimezone)
262+
await updateZoomMeeting(interviewEntity.startTimestamp, interviewEntity.duration, interviewEntity.zoomAccountApiKey, interviewEntity.zoomMeetingId)
263263

264264
const interviewCancelLink = `${config.TAAS_APP_BASE_URL}/interview/${interview.id}/cancel`
265265
const interviewRescheduleLink = `${config.TAAS_APP_BASE_URL}/interview/${interview.id}/reschedule`

src/services/ZoomService.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const _ = require('lodash')
22
const axios = require('axios')
33
const jwt = require('jsonwebtoken')
44
const config = require('config')
5+
const moment = require('moment')
56

67
// get & parse all Zoom account credentials in an in-memory array
78
const ALL_ZOOM_ACCOUNTS = _.split(config.ZOOM_ACCOUNTS, ',')
@@ -66,18 +67,16 @@ async function generateZoomJWTBearerAccessToken (apiKey) {
6667
*
6768
* @param {Date} startTime the start time of the meeting
6869
* @param {Integer} duration the duration of the meeting
69-
* @param {String} timezone the timezone of the meeting
7070
* @returns Zoom API response
7171
*/
72-
async function createZoomMeeting (startTime, duration, timezone) {
72+
async function createZoomMeeting (startTime, duration) {
7373
const { accessToken, zoomAccountApiKey } = await generateZoomJWTBearerAccessToken()
7474

7575
// POST request details in Zoom API docs:
7676
// https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate
7777
const res = await axios.post('https://api.zoom.us/v2/users/me/meetings', {
7878
type: 2,
79-
start_time: startTime.toISOString(),
80-
timezone,
79+
start_time: moment(startTime).utc().format(),
8180
duration
8281
}, {
8382
headers: {
@@ -96,12 +95,11 @@ async function createZoomMeeting (startTime, duration, timezone) {
9695
*
9796
* @param {Date} startTime the start time of the meeting
9897
* @param {Integer} duration the duration of the meeting
99-
* @param {String} timezone the timezone of the meeting
10098
* @returns The meeting urls for the Zoom meeting
10199
*/
102-
async function generateZoomMeetingLink (startTime, duration, timezone) {
100+
async function generateZoomMeetingLink (startTime, duration) {
103101
try {
104-
const { meeting, zoomAccountApiKey } = await createZoomMeeting(startTime, duration, timezone)
102+
const { meeting, zoomAccountApiKey } = await createZoomMeeting(startTime, duration)
105103

106104
// learn more: https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate#responses
107105
console.log(meeting.start_url, 'Zoom meeting link for host')
@@ -121,16 +119,14 @@ async function generateZoomMeetingLink (startTime, duration, timezone) {
121119
* @param {Integer} duration the duration of the meeting
122120
* @param {String} apiKey zoom account api key
123121
* @param {Integer} zoomMeetingId zoom meeting id
124-
* @param {String} timezone the timezone of the meeting
125122
* @returns {undefined}
126123
*/
127-
async function updateZoomMeeting (startTime, duration, zoomAccountApiKey, zoomMeetingId, timezone) {
124+
async function updateZoomMeeting (startTime, duration, zoomAccountApiKey, zoomMeetingId) {
128125
const { accessToken } = await generateZoomJWTBearerAccessToken(zoomAccountApiKey)
129126
// PATCH request details in Zoom API docs:
130127
// https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate
131128
await axios.patch(`https://api.zoom.us/v2/meetings/${zoomMeetingId}`, {
132-
start_time: startTime.toISOString(),
133-
timezone,
129+
start_time: moment(startTime).utc().format(),
134130
duration
135131
}, {
136132
headers: {

0 commit comments

Comments
 (0)