feat(video-assets): add full video asset system (uploads, downloads, @mentions, and cleanup/billing integration)

This commit is contained in:
Yusuf İpek
2026-02-25 18:34:03 +03:00
parent 6eea327083
commit 9ce033d306
32 changed files with 3524 additions and 231 deletions
+41
View File
@@ -29,6 +29,8 @@ model User {
workspaceMemberships WorkspaceMember[]
projects Project[]
comments Comment[]
uploadedVideoAssets VideoAsset[] @relation("VideoAssetUploadedBy")
billedVideoAssets VideoAsset[] @relation("VideoAssetBilledTo")
projectMemberships ProjectMember[]
notificationSetting NotificationSetting?
watchProgress WatchProgress[]
@@ -65,6 +67,17 @@ enum DownloadEgressSource {
COMPRESSED
}
enum VideoAssetKind {
IMAGE
VIDEO
}
enum VideoAssetProvider {
R2_IMAGE
YOUTUBE
BUNNY
}
model DownloadEgressEvent {
id String @id @default(cuid())
versionId String
@@ -303,6 +316,7 @@ model Video {
// Relations
versions VideoVersion[]
assets VideoAsset[]
shareLinks ShareLink[]
@@index([projectId])
@@ -345,6 +359,33 @@ model VideoVersion {
@@map("video_versions")
}
model VideoAsset {
id String @id @default(cuid())
videoId String
video Video @relation(fields: [videoId], references: [id], onDelete: Cascade)
kind VideoAssetKind
provider VideoAssetProvider
displayName String
sourceUrl String
providerVideoId String?
thumbnailUrl String?
uploadedByUserId String?
uploadedByUser User? @relation("VideoAssetUploadedBy", fields: [uploadedByUserId], references: [id], onDelete: SetNull)
uploadedByGuestIdentityId String?
uploadedByGuestName String?
billedUserId String
billedUser User @relation("VideoAssetBilledTo", fields: [billedUserId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([videoId])
@@index([billedUserId])
@@index([provider])
@@index([providerVideoId])
@@index([videoId, createdAt(sort: Desc)])
@@map("video_assets")
}
model Comment {
id String @id @default(cuid())