Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Credential of type video wrong id on bookingReference (#9281)

alannncd0707422b98d
diff --git a/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts b/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts
index bff9234217f..353fd020a33 100644
--- a/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts
+++ b/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts
@@ -56,10 +56,10 @@ const meetingTokenSchema = z.object({
/** @deprecated use metadata on index file */
export const FAKE_DAILY_CREDENTIAL: CredentialPayload & { invalid: boolean } = {
- id: +new Date().getTime(),
+ id: 0,
type: "daily_video",
key: { apikey: process.env.DAILY_API_KEY },
- userId: +new Date().getTime(),
+ userId: 0,
appId: "daily-video",
invalid: false,
teamId: undefined,
diff --git a/packages/app-store/utils.ts b/packages/app-store/utils.ts
index 6cd2e7df6fa..20b7b74822a 100644
--- a/packages/app-store/utils.ts
+++ b/packages/app-store/utils.ts
@@ -116,11 +116,11 @@ function getApps(userCredentials: CredentialData[]) {
/** If the app is a globally installed one, let's inject it's key */
if (appMeta.isGlobal) {
credentials.push({
- id: +new Date().getTime(),
+ id: 0,
type: appMeta.type,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
key: appMeta.key!,
- userId: +new Date().getTime(),
+ userId: 0,
appId: appMeta.slug,
invalid: false,
});
diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts
index e4969648919..95f1d9951a2 100644
--- a/packages/core/EventManager.ts
+++ b/packages/core/EventManager.ts
@@ -130,13 +130,14 @@ export default class EventManager {
return result.type.includes("_calendar");
};
+ // References can be any type: calendar/video
const referencesToCreate = results.map((result) => {
let createdEventObj: createdEventSchema | null = null;
if (typeof result?.createdEvent === "string") {
createdEventObj = createdEventSchema.parse(JSON.parse(result.createdEvent));
}
-
- if (isCalendarResult(result)) {
+ const isCalendarType = isCalendarResult(result);
+ if (isCalendarType) {
evt.iCalUID = result.iCalUID || undefined;
}
@@ -146,8 +147,8 @@ export default class EventManager {
meetingId: createdEventObj ? createdEventObj.id : result.createdEvent?.id?.toString(),
meetingPassword: createdEventObj ? createdEventObj.password : result.createdEvent?.password,
meetingUrl: createdEventObj ? createdEventObj.onlineMeetingUrl : result.createdEvent?.url,
- externalCalendarId: evt.destinationCalendar?.externalId,
- credentialId: evt.destinationCalendar?.credentialId,
+ externalCalendarId: isCalendarType ? evt.destinationCalendar?.externalId : undefined,
+ credentialId: isCalendarType ? evt.destinationCalendar?.credentialId : result.credentialId,
};
});
@@ -186,7 +187,7 @@ export default class EventManager {
meetingPassword: result.createdEvent?.password,
meetingUrl: result.createdEvent?.url,
externalCalendarId: evt.destinationCalendar?.externalId,
- credentialId: evt.destinationCalendar?.credentialId,
+ credentialId: result.credentialId ?? evt.destinationCalendar?.credentialId,
};
});
@@ -504,6 +505,7 @@ export default class EventManager {
success: false,
uid: "",
originalEvent: event,
+ credentialId: cred.id,
};
}
const { externalCalendarId: bookingExternalCalendarId, meetingId: bookingRefUid } =
@@ -526,6 +528,7 @@ export default class EventManager {
success: false,
uid: "",
originalEvent: event,
+ credentialId: 0,
},
]);
}
diff --git a/packages/core/videoClient.ts b/packages/core/videoClient.ts
index 2a111160551..098d98b0cd7 100644
--- a/packages/core/videoClient.ts
+++ b/packages/core/videoClient.ts
@@ -67,6 +67,7 @@ const createMeeting = async (credential: CredentialWithAppName, calEvent: Calend
originalEvent: CalendarEvent;
success: boolean;
createdEvent: VideoCallData | undefined;
+ credentialId: number;
} = {
appName: credential.appName,
type: credential.type,
@@ -74,6 +75,7 @@ const createMeeting = async (credential: CredentialWithAppName, calEvent: Calend
originalEvent: calEvent,
success: false,
createdEvent: undefined,
+ credentialId: credential.id,
};
try {
// Check to see if video app is enabled
diff --git a/packages/types/EventManager.d.ts b/packages/types/EventManager.d.ts
index 1f60ba13f5c..d93069f63e8 100644
--- a/packages/types/EventManager.d.ts
+++ b/packages/types/EventManager.d.ts
@@ -22,6 +22,7 @@ export interface EventResult<T> {
originalEvent: CalendarEvent;
calError?: string;
calWarnings?: string[];
+ credentialId?: number;
}
export interface CreateUpdateResult {