// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } enum TransferStatus { ACTIVE EXPIRED DELETED } model User { id String @id @default(cuid()) name String? email String? @unique emailVerified DateTime? image String? plan String @default("free") // "free", "rookie", or "pro" // Optional transfers Transfer[] @relation("UserTransfers") accounts Account[] sessions Session[] } model Account { id String @id @default(cuid()) userId String type String provider String providerAccountId String refresh_token String? access_token String? expires_at Int? token_type String? scope String? id_token String? session_state String? user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([provider, providerAccountId]) } model Session { id String @id @default(cuid()) sessionToken String @unique userId String expires DateTime user User @relation(fields: [userId], references: [id], onDelete: Cascade) } model VerificationToken { identifier String token String @unique expires DateTime @@unique([identifier, token]) } model Transfer { id Int @id @default(autoincrement()) senderEmail String recipientEmail String passwordHash String? downloadUrl String @unique createdAt DateTime @default(now()) expiresAt DateTime files File[] filenames String? // JSON stringified array of filenames totalFiles Int @default(0) // new field to track number of files in transfer totalSize BigInt @default(0) // Use BigInt to support files > 2GB message String? // optional message status TransferStatus @default(ACTIVE) // Added userId String? // Change from Int? to String? user User? @relation("UserTransfers", fields: [userId], references: [id]) } model File { id Int @id @default(autoincrement()) name String path String size BigInt // Use BigInt to support files > 2GB encryptionIv String? // 12-byte IV as base64 string for AES-GCM decryption transferId Int transfer Transfer @relation(fields: [transferId], references: [id]) downloads FileDownload[] // New } model FileDownload { id Int @id @default(autoincrement()) fileId Int file File @relation(fields: [fileId], references: [id], onDelete: Cascade) timestamp DateTime @default(now()) ip String? userAgent String? }