Add Device/Video models, signaling WebSocket, device and content routes
- Prisma: Device model (Quest/Phone, online status, battery, storage, game/streaming/cortex state), Video model with likes, VideoLike - Signaling WebSocket for SDP/ICE relay and device presence - Device routes: list, status, delete - Content routes: video CRUD with range-support streaming - SignalingManager service for device socket registry and heartbeat
This commit is contained in:
@@ -25,6 +25,9 @@ model User {
|
||||
followers Follow[] @relation("following")
|
||||
following Follow[] @relation("follower")
|
||||
likes Like[]
|
||||
devices Device[]
|
||||
videos Video[]
|
||||
videoLikes VideoLike[]
|
||||
}
|
||||
|
||||
model PairingCode {
|
||||
@@ -130,3 +133,54 @@ model Like {
|
||||
@@unique([userId, planId])
|
||||
@@index([planId])
|
||||
}
|
||||
|
||||
model Device {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
deviceId String
|
||||
deviceName String @default("")
|
||||
deviceType String @default("QUEST") // "QUEST" or "PHONE"
|
||||
isOnline Boolean @default(false)
|
||||
lastSeen DateTime @default(now())
|
||||
batteryLevel Int?
|
||||
storageAvailable Int?
|
||||
runningGame String?
|
||||
streamingState String?
|
||||
cortexState String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([userId, deviceId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model Video {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
title String
|
||||
description String @default("")
|
||||
duration Int @default(0)
|
||||
thumbnailUrl String?
|
||||
videoUrl String
|
||||
fileSize Int?
|
||||
isPublic Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
likes VideoLike[]
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model VideoLike {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
videoId String
|
||||
video Video @relation(fields: [videoId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([userId, videoId])
|
||||
@@index([videoId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user