fix: backward compatibility for old cal rooms (#15609)

* fix: record icon for old rooms

* chore: change function name
This commit is contained in:
Udit Takkar authored and GitHub committed 2024-06-28 09:42:38 +01:00
1 parent a52f7efe88
commit c458b297ae
4 files changed
+54 -3

No files matched your search

@@ -116,6 +116,38 @@ export const generateGuestMeetingTokenFromOwnerMeetingToken = async (meetingToke
return guestMeetingToken.token;
};
// Only for backward compatibility
export const setEnableRecordingUIForOrganizer = async (
bookingReferenceId: number,
meetingToken: string | null
) => {
if (!meetingToken) return null;
const token = await fetcher(`/meeting-tokens/${meetingToken}`).then(ZGetMeetingTokenResponseSchema.parse);
if (token.enable_recording_ui === false) return null;
const organizerMeetingToken = await postToDailyAPI("/meeting-tokens", {
properties: {
room_name: token.room_name,
exp: token.exp,
enable_recording_ui: false,
is_owner: true,
},
}).then(meetingTokenSchema.parse);
// Update the meetingPassword in the database
await prisma.bookingReference.update({
where: {
id: bookingReferenceId,
},
data: {
meetingPassword: organizerMeetingToken.token,
},
});
return organizerMeetingToken.token;
};
const DailyVideoApiAdapter = (): VideoApiAdapter => {
async function createOrUpdateMeeting(endpoint: string, event: CalendarEvent): Promise<VideoCallData> {
if (!event.uid) {
@@ -62,5 +62,6 @@ export const ZGetMeetingTokenResponseSchema = z
.object({
room_name: z.string(),
exp: z.number(),
enable_recording_ui: z.boolean().optional(),
})
.passthrough();
@@ -1,4 +1,5 @@
export type Reference = {
id: number;
uid: string;
type: string;
meetingUrl: string | null;