// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") } enum Role { USER ADMIN } model Account { id String @id @default(cuid()) userId String @map("user_id") type String provider String providerAccountId String @map("provider_account_id") refresh_token String? @db.Text access_token String? @db.Text expires_at Int? token_type String? scope String? id_token String? @db.Text session_state String? user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([provider, providerAccountId]) @@map("accounts") } model Session { id String @id @default(cuid()) sessionToken String @unique @map("session_token") userId String @map("user_id") expires DateTime user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@map("sessions") } model User { id String @id @default(cuid()) name String? surname String? username String? @unique email String? @unique emailVerified DateTime? @map("email_verified") emailVerificationToken String? @unique @map("email_verification_agent") passwordHash String? @map("password_hash") resetPasswordToken String? @unique @map("reset_password_token") resetPasswordTokenExpiry DateTime? @map("reset_password_token_expiry") image String? createdAt DateTime @default(now()) @map("created_at") role Role @default(USER) accounts Account[] sessions Session[] resumes Resume[] // Add this line to indicate relation to Resume model @@map("users") } model VerificationToken { identifier String token String @unique expires DateTime @@unique([identifier, token]) @@map("verification_tokens") } model NewsletterSubscriber { id String @id @default(cuid()) email String @unique createdAt DateTime @default(now()) @map("created_at") @@map("newsletter_subscribers") } model Resume { id String @id @default(cuid()) userId String @map("user_id") price Float name String? // Optional: full name of the user, if not split into separate fields email String? phone String? address String? objective String? // Career objective or summary education Json // JSON array to store multiple entries for education history experience Json // JSON array to store multiple work experiences skills Json // JSON array to store skills certifications Json // JSON array to store certifications or licenses languages Json // JSON array to store languages and proficiency levels references Json // JSON array to store reference contacts template String? // Optional: Identifier for the resume template used status String @default("draft") // Status like draft, submitted, published createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime? @updatedAt submittedAt DateTime? // Timestamp when the resume was submitted, if applicable user User @relation(fields: [userId], references: [id], onDelete: Cascade) purchases Purchase[] @@map("resumes") } model Purchase { id String @id @default(uuid()) userId String resumeId String resume Resume @relation(fields: [resumeId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt() @@unique([userId, resumeId]) @@index([resumeId]) } model StripeCustomer { id String @id @default(uuid()) userId String @unique stripeCustomerId String @unique createdAt DateTime @default(now()) updatedAt DateTime @updatedAt }