| 1 | generator client { |
| 2 | provider = "prisma-client" |
| 3 | output = "../prisma/generated" |
| 4 | runtime = "edge-light" |
| 5 | previewFeatures = ["relationJoins"] |
| 6 | } |
| 7 | |
| 8 | generator client_migrate { |
| 9 | provider = "prisma-client" |
| 10 | output = "../prisma/local/generated" |
| 11 | runtime = "nodejs" |
| 12 | previewFeatures = ["relationJoins"] |
| 13 | } |
| 14 | |
| 15 | datasource db { |
| 16 | provider = "postgresql" |
| 17 | } |
| 18 | |
| 19 | model Account { |
| 20 | id String @id @default(cuid()) |
| 21 | userId String |
| 22 | type String |
| 23 | provider String |
| 24 | providerAccountId String |
| 25 | refresh_token String? |
| 26 | access_token String? |
| 27 | expires_at Int? |
| 28 | token_type String? |
| 29 | scope String? |
| 30 | id_token String? |
| 31 | session_state String? |
| 32 | refresh_token_expires_in Int? |
| 33 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 34 | |
| 35 | @@unique([provider, providerAccountId]) |
| 36 | } |
| 37 | |
| 38 | enum UserRole { |
| 39 | ADMIN |
| 40 | USER |
| 41 | } |
| 42 | |
| 43 | model User { |
| 44 | id String @id @default(cuid()) |
| 45 | name String? |
| 46 | email String? @unique |
| 47 | password String? |
| 48 | emailVerified DateTime? |
| 49 | image String? |
| 50 | createdAt DateTime @default(now()) |
| 51 | updatedAt DateTime @default(now()) @updatedAt |
| 52 | headline String? @db.VarChar(100) |
| 53 | bio String? @db.Text |
| 54 | interests String[] |
| 55 | location String? |
| 56 | website String? |
| 57 | role UserRole @default(USER) |
| 58 | hasAccess Boolean @default(false) |
| 59 | accounts Account[] |
| 60 | documents BaseDocument[] |
| 61 | favorites FavoriteDocument[] |
| 62 | generatedImages GeneratedImage[] |
| 63 | presentationThemes PresentationTheme[] |
| 64 | favoritePresentationThemes FavoritePresentationTheme[] |
| 65 | presentationThemeLikes PresentationThemeLike[] |
| 66 | fontPairs FontPair[] |
| 67 | } |
| 68 | |
| 69 | enum DocumentType { |
| 70 | NOTE |
| 71 | DOCUMENT |
| 72 | DRAWING |
| 73 | DESIGN |
| 74 | STICKY_NOTES |
| 75 | MIND_MAP |
| 76 | RESEARCH_PAPER |
| 77 | FLIPBOOK |
| 78 | PRESENTATION |
| 79 | } |
| 80 | |
| 81 | model BaseDocument { |
| 82 | id String @id @default(cuid()) |
| 83 | title String |
| 84 | type DocumentType |
| 85 | userId String |
| 86 | thumbnailUrl String? |
| 87 | createdAt DateTime @default(now()) |
| 88 | updatedAt DateTime @updatedAt |
| 89 | isPublic Boolean @default(false) |
| 90 | documentType String |
| 91 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 92 | presentation Presentation? |
| 93 | favorites FavoriteDocument[] |
| 94 | } |
| 95 | |
| 96 | model Presentation { |
| 97 | id String @id @default(cuid()) |
| 98 | content Json |
| 99 | theme String @default("mystique") |
| 100 | imageSource String? @default("ai") |
| 101 | prompt String? |
| 102 | presentationStyle String? |
| 103 | customization Json? |
| 104 | language String? @default("en-US") |
| 105 | outline String[] |
| 106 | searchResults Json? |
| 107 | toolCalls Json? |
| 108 | selectedChunks Json? |
| 109 | templateId String? |
| 110 | base BaseDocument @relation(fields: [id], references: [id], onDelete: Cascade) |
| 111 | } |
| 112 | |
| 113 | model PresentationTheme { |
| 114 | id String @id @default(cuid()) |
| 115 | name String |
| 116 | description String? |
| 117 | userId String |
| 118 | logoUrl String? |
| 119 | isPublic Boolean @default(false) |
| 120 | createdAt DateTime @default(now()) |
| 121 | updatedAt DateTime @updatedAt |
| 122 | isAdmin Boolean @default(false) |
| 123 | themeData Json |
| 124 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 125 | favoritePresentationThemes FavoritePresentationTheme[] |
| 126 | presentationThemeLikes PresentationThemeLike[] |
| 127 | |
| 128 | @@index([userId]) |
| 129 | @@map("CustomTheme") |
| 130 | } |
| 131 | |
| 132 | model FavoritePresentationTheme { |
| 133 | id String @id @default(cuid()) |
| 134 | userId String |
| 135 | themeId String |
| 136 | createdAt DateTime @default(now()) |
| 137 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 138 | theme PresentationTheme @relation(fields: [themeId], references: [id], onDelete: Cascade) |
| 139 | |
| 140 | @@unique([userId, themeId]) |
| 141 | @@index([userId]) |
| 142 | @@index([themeId]) |
| 143 | } |
| 144 | |
| 145 | model PresentationThemeLike { |
| 146 | id String @id @default(cuid()) |
| 147 | userId String |
| 148 | themeId String |
| 149 | createdAt DateTime @default(now()) |
| 150 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 151 | theme PresentationTheme @relation(fields: [themeId], references: [id], onDelete: Cascade) |
| 152 | |
| 153 | @@unique([userId, themeId]) |
| 154 | @@index([userId]) |
| 155 | @@index([themeId]) |
| 156 | } |
| 157 | |
| 158 | model FontPair { |
| 159 | id String @id @default(cuid()) |
| 160 | heading String |
| 161 | headingUrl String? |
| 162 | headingWeight Int @default(700) |
| 163 | body String |
| 164 | bodyUrl String? |
| 165 | bodyWeight Int @default(400) |
| 166 | userId String |
| 167 | createdAt DateTime @default(now()) |
| 168 | updatedAt DateTime @updatedAt |
| 169 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 170 | |
| 171 | @@index([userId]) |
| 172 | } |
| 173 | |
| 174 | model FavoriteDocument { |
| 175 | id String @id @default(uuid()) |
| 176 | documentId String |
| 177 | userId String |
| 178 | document BaseDocument @relation(fields: [documentId], references: [id], onDelete: Cascade) |
| 179 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 180 | |
| 181 | @@unique([userId, documentId]) |
| 182 | } |
| 183 | |
| 184 | model GeneratedImage { |
| 185 | id String @id @default(cuid()) |
| 186 | url String |
| 187 | createdAt DateTime @default(now()) |
| 188 | updatedAt DateTime @updatedAt |
| 189 | userId String |
| 190 | prompt String |
| 191 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 192 | } |
| 193 |