Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add database video decoder for storage-aware domain

Richie McIlroyba5eec64ba63
diff --git a/apps/web/lib/video-storage.ts b/apps/web/lib/video-storage.ts
new file mode 100644
index 000000000..f37409c6d
--- /dev/null
+++ b/apps/web/lib/video-storage.ts
@@ -0,0 +1,18 @@
+import type { videos } from "@cap/database/schema";
+import { Video } from "@cap/web-domain";
+import { Option } from "effect";
+
+type DbVideo = typeof videos.$inferSelect;
+
+export const decodeStorageVideo = (video: DbVideo) =>
+ Video.Video.make({
+ ...video,
+ metadata: Option.fromNullable(video.metadata),
+ bucketId: Option.fromNullable(video.bucket),
+ storageIntegrationId: Option.fromNullable(video.storageIntegrationId),
+ folderId: Option.fromNullable(video.folderId),
+ transcriptionStatus: Option.fromNullable(video.transcriptionStatus),
+ width: Option.fromNullable(video.width),
+ height: Option.fromNullable(video.height),
+ duration: Option.fromNullable(video.duration),
+ });