Phase 1: Backend scaffold with Fastify, Prisma, Docker
This commit is contained in:
85
prisma/schema.prisma
Normal file
85
prisma/schema.prisma
Normal file
@@ -0,0 +1,85 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
metaId String @unique
|
||||
displayName String
|
||||
email String?
|
||||
avatarUrl String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
linkedAccounts LinkedAccount[]
|
||||
streamPlans StreamPlan[]
|
||||
sessions Session[]
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
refreshToken String @unique
|
||||
expiresAt DateTime
|
||||
deviceInfo String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model LinkedAccount {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
displayName String
|
||||
accountId String
|
||||
avatarUrl String?
|
||||
accessTokenEnc String
|
||||
refreshTokenEnc String
|
||||
tokenExpiresAt DateTime
|
||||
accessTokenIv String
|
||||
refreshTokenIv String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([userId, serviceId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model StreamPlan {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
name String
|
||||
status String @default("DRAFT")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
destinations StreamDestination[]
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model StreamDestination {
|
||||
id String @id @default(uuid())
|
||||
planId String
|
||||
plan StreamPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
title String
|
||||
description String @default("")
|
||||
privacyStatus String @default("public")
|
||||
gameId String @default("")
|
||||
tags String @default("")
|
||||
rtmpUrl String @default("")
|
||||
streamKey String @default("")
|
||||
broadcastId String @default("")
|
||||
status String @default("PENDING")
|
||||
|
||||
@@index([planId])
|
||||
}
|
||||
Reference in New Issue
Block a user