fix: update meeting token if expired (#17096)
This commit is contained in:
1 parent
a48d190af3
commit
0b914bef79
3 files changed
+55
-3
No files matched your search
@@ -98,6 +98,46 @@ async function processTranscriptsInBatches(transcriptIds: Array<string>) {
|
||||
return allTranscriptsAccessLinks;
|
||||
}
|
||||
|
||||
export const updateMeetingTokenIfExpired = async ({
|
||||
bookingReferenceId,
|
||||
meetingToken,
|
||||
roomName,
|
||||
exp,
|
||||
}: {
|
||||
bookingReferenceId: number;
|
||||
meetingToken: string | null;
|
||||
roomName: string;
|
||||
exp: number;
|
||||
}) => {
|
||||
if (!meetingToken) return null;
|
||||
|
||||
try {
|
||||
await fetcher(`/meeting-tokens/${meetingToken}`).then(ZGetMeetingTokenResponseSchema.parse);
|
||||
} catch (err) {
|
||||
const organizerMeetingToken = await postToDailyAPI("/meeting-tokens", {
|
||||
properties: {
|
||||
room_name: roomName,
|
||||
exp: exp,
|
||||
enable_recording_ui: false,
|
||||
is_owner: true,
|
||||
},
|
||||
}).then(meetingTokenSchema.parse);
|
||||
|
||||
await prisma.bookingReference.update({
|
||||
where: {
|
||||
id: bookingReferenceId,
|
||||
},
|
||||
data: {
|
||||
meetingPassword: organizerMeetingToken.token,
|
||||
},
|
||||
});
|
||||
|
||||
return organizerMeetingToken.token;
|
||||
}
|
||||
|
||||
return meetingToken;
|
||||
};
|
||||
|
||||
export const generateGuestMeetingTokenFromOwnerMeetingToken = async (
|
||||
meetingToken: string | null,
|
||||
userId?: number
|
||||
|
||||
@@ -65,6 +65,6 @@ export const ZGetMeetingTokenResponseSchema = z
|
||||
room_name: z.string(),
|
||||
exp: z.number(),
|
||||
enable_recording_ui: z.boolean().optional(),
|
||||
user_id: z.number().optional(),
|
||||
user_id: z.number().nullable().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
Reference in new issue
Block a user