feat: create trpc route to fetch download link (#7495)

* feat: create trpc route to fetch download link

Signed-off-by: Udit Takkar <[email protected]>

* fix: removing file, adding isdownloadable logix

Signed-off-by: Udit Takkar <[email protected]>

* chore

Signed-off-by: Udit Takkar <[email protected]>

* fix: type error

Signed-off-by: Udit Takkar <[email protected]>

* Some performance enhancements and better error logging

* Add error message here too

---------

Signed-off-by: Udit Takkar <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
Udit TakkarandAlex van Andel authored and GitHub committed 2023-03-05 12:59:07 +00:00
1 parent cc1d606ba8
commit 2dddd4ce77
8 files changed
+204 -122

No files matched your search

+32 -3
View File
@@ -7,9 +7,9 @@ import { sendBrokenIntegrationEmail } from "@calcom/emails";
import { getUid } from "@calcom/lib/CalEventParser";
import logger from "@calcom/lib/logger";
import { prisma } from "@calcom/prisma";
import { GetRecordingsResponseSchema } from "@calcom/prisma/zod-utils";
import type { GetRecordingsResponseSchema } from "@calcom/prisma/zod-utils";
import type { CalendarEvent, EventBusyDate } from "@calcom/types/Calendar";
import { CredentialPayload, CredentialWithAppName } from "@calcom/types/Credential";
import type { CredentialPayload, CredentialWithAppName } from "@calcom/types/Credential";
import type { EventResult, PartialReference } from "@calcom/types/EventManager";
import type { VideoApiAdapter, VideoApiAdapterFactory, VideoCallData } from "@calcom/types/VideoApiAdapter";
@@ -175,6 +175,7 @@ const getRecordingsOfCalVideoByRoomName = async (
try {
dailyAppKeys = await getDailyAppKeys();
} catch (e) {
console.error("Error: Cal video provider is not installed.");
return;
}
const [videoAdapter] = getVideoAdapters([
@@ -190,4 +191,32 @@ const getRecordingsOfCalVideoByRoomName = async (
return videoAdapter?.getRecordings?.(roomName);
};
export { getBusyVideoTimes, createMeeting, updateMeeting, deleteMeeting, getRecordingsOfCalVideoByRoomName };
const getDownloadLinkOfCalVideoByRecordingId = async (recordingId: string) => {
let dailyAppKeys: Awaited<ReturnType<typeof getDailyAppKeys>>;
try {
dailyAppKeys = await getDailyAppKeys();
} catch (e) {
console.error("Error: Cal video provider is not installed.");
return;
}
const [videoAdapter] = getVideoAdapters([
{
id: 0,
appId: "daily-video",
type: "daily_video",
userId: null,
key: dailyAppKeys,
invalid: false,
},
]);
return videoAdapter?.getRecordingDownloadLink?.(recordingId);
};
export {
getBusyVideoTimes,
createMeeting,
updateMeeting,
deleteMeeting,
getRecordingsOfCalVideoByRoomName,
getDownloadLinkOfCalVideoByRecordingId,
};