157 lines
5.1 KiB
Plaintext
157 lines
5.1 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "debian-openssl-3.0.x"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
plexId String @unique @map("plex_id")
|
|
plexUsername String @map("plex_username")
|
|
email String?
|
|
isAdmin Boolean @default(false) @map("is_admin")
|
|
isActive Boolean @default(true) @map("is_active")
|
|
totalEarned Int @default(0) @map("total_earned")
|
|
totalSpent Int @default(0) @map("total_spent")
|
|
watchTimeMinutes Int @default(0) @map("watch_time_minutes")
|
|
|
|
transactions Transaction[]
|
|
watchEvents WatchEvent[]
|
|
contentRequests ContentRequest[]
|
|
sessions Session[]
|
|
kofiPayments KofiPayment[]
|
|
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
@@index([plexId])
|
|
@@map("users")
|
|
}
|
|
|
|
model Transaction {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
user User @relation(fields: [userId], references: [id])
|
|
type TransactionType
|
|
amount Int
|
|
watchEventId String? @map("watch_event_id")
|
|
watchEvent WatchEvent? @relation(fields: [watchEventId], references: [id])
|
|
requestId String? @unique @map("request_id")
|
|
request ContentRequest? @relation(fields: [requestId], references: [id])
|
|
description String?
|
|
contentTitle String? @map("content_title")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
@@index([userId])
|
|
@@index([createdAt])
|
|
@@map("transactions")
|
|
}
|
|
|
|
model WatchEvent {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
user User @relation(fields: [userId], references: [id])
|
|
sessionId String @map("session_id")
|
|
ratingKey String @map("rating_key")
|
|
contentType String @map("content_type")
|
|
title String
|
|
grandparentTitle String? @map("grandparent_title")
|
|
duration Int
|
|
percentComplete Int @map("percent_complete")
|
|
creditsEarned Int @map("credits_earned")
|
|
isProcessed Boolean @default(false) @map("is_processed")
|
|
transactions Transaction[]
|
|
watchedAt DateTime @map("watched_at")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
@@unique([sessionId])
|
|
@@index([userId])
|
|
@@index([watchedAt])
|
|
@@map("watch_events")
|
|
}
|
|
|
|
model ContentRequest {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
user User @relation(fields: [userId], references: [id])
|
|
overseerRequestId Int @map("overseer_request_id")
|
|
mediaType String @map("media_type")
|
|
tmdbId Int @map("tmdb_id")
|
|
title String
|
|
creditsCost Int @map("credits_cost")
|
|
status RequestStatus @default(PENDING)
|
|
transaction Transaction?
|
|
requestedAt DateTime @map("requested_at")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
@@index([userId])
|
|
@@map("content_requests")
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
user User @relation(fields: [userId], references: [id])
|
|
token String @unique
|
|
expiresAt DateTime @map("expires_at")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
@@index([userId])
|
|
@@index([token])
|
|
@@map("sessions")
|
|
}
|
|
|
|
model SystemSettings {
|
|
id String @id @default(cuid())
|
|
creditsPerMinute Int @default(2) @map("credits_per_minute")
|
|
minWatchPercent Int @default(80) @map("min_watch_percent")
|
|
minWatchMinutes Int @default(5) @map("min_watch_minutes")
|
|
movieRequestCost Int @default(500) @map("movie_request_cost")
|
|
tvRequestCost Int @default(1000) @map("tv_request_cost")
|
|
tvPerSeasonCost Int @default(250) @map("tv_per_season_cost")
|
|
newReleaseMultiplier Decimal @default(1.5) @map("new_release_multiplier") @db.Decimal(3, 2)
|
|
bonusMultiplierActive Boolean @default(false) @map("bonus_multiplier_active")
|
|
bonusMultiplier Decimal @default(2.0) @map("bonus_multiplier") @db.Decimal(3, 2)
|
|
mintingPaused Boolean @default(false) @map("minting_paused")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
updatedBy String? @map("updated_by")
|
|
@@map("system_settings")
|
|
}
|
|
|
|
model KofiPayment {
|
|
id String @id @default(uuid())
|
|
kofiTransactionId String @unique @map("kofi_transaction_id")
|
|
email String
|
|
fromName String @map("from_name")
|
|
amount Float
|
|
creditsGranted Int @map("credits_granted")
|
|
message String?
|
|
isPublic Boolean @default(true) @map("is_public")
|
|
currency String @default("USD")
|
|
userId String? @map("user_id")
|
|
user User? @relation(fields: [userId], references: [id])
|
|
status String @default("PENDING")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
@@index([userId])
|
|
@@index([email])
|
|
@@index([status])
|
|
@@map("kofi_payments")
|
|
}
|
|
|
|
enum TransactionType {
|
|
EARN
|
|
SPEND
|
|
BONUS
|
|
ADJUSTMENT
|
|
PURCHASE
|
|
}
|
|
|
|
enum RequestStatus {
|
|
PENDING
|
|
APPROVED
|
|
DECLINED
|
|
COMPLETED
|
|
}
|