-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.prisma
More file actions
351 lines (309 loc) · 9.37 KB
/
Copy pathschema.prisma
File metadata and controls
351 lines (309 loc) · 9.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "rhel-openssl-1.0.x"]
}
datasource db {
provider = "postgresql"
relationMode = "prisma"
}
model User {
id String @id @default(uuid()) @db.Uuid
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
email String @unique
hashedPassword String
firstName String?
lastName String?
isActive Boolean @default(true)
mediaAssets MediaAsset[]
activityLogs ActivityLog[]
@@map("users")
}
model ContactSubmission {
id String @id @default(cuid())
name String
email String
message String
isRead Boolean @default(false)
status InquiryStatus @default(NEW)
internalNotes String?
source String @default("contact")
estimatorLeadId String? @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
estimatorLead EstimatorLead? @relation(fields: [estimatorLeadId], references: [id], onDelete: SetNull)
feedback ConsultationFeedback?
@@index([status])
@@index([source])
@@map("contact_submissions")
}
model ConsultationFeedback {
id String @id @default(cuid())
contactSubmissionId String @unique
rating Int
comment String?
isRead Boolean @default(false)
createdAt DateTime @default(now())
contactSubmission ContactSubmission @relation(fields: [contactSubmissionId], references: [id], onDelete: Cascade)
@@index([isRead])
@@index([createdAt])
@@map("consultation_feedback")
}
model EstimatorLead {
id String @id @default(cuid())
projectType String
designApproach String?
platform String?
scope String
complexity String
timeline String
budgetUsd Decimal @db.Decimal(19, 2)
budgetDisplay String
excludedDeliverables Json?
deliverableSavingsUsd Decimal? @db.Decimal(19, 2)
currency String @default("USD")
status EstimatorLeadStatus @default(NEW)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
shareToken String @unique @default(cuid())
contactSubmission ContactSubmission?
@@index([status])
@@map("estimator_leads")
}
model Testimonial {
id String @id @default(cuid())
clientName String
clientRole String
company String
content String
avatarUrl String?
isVisible Boolean @default(true)
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([isVisible])
@@map("testimonials")
}
model Project {
id String @id @default(cuid())
title String
slug String @unique
description String
content String?
category String
imageUrl String
liveUrl String?
githubUrl String?
isFeatured Boolean @default(false)
isVisible Boolean @default(true)
featuredOrder Int @default(0)
completedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
techStacks ProjectTechStack[]
developers ProjectDeveloper[]
@@index([isVisible])
@@index([isFeatured])
@@index([featuredOrder])
@@map("projects")
}
model ProjectTechStack {
id String @id @default(cuid())
name String
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
@@unique([projectId, name])
@@index([projectId])
@@map("project_tech_stacks")
}
model ProjectDeveloper {
id String @id @default(cuid())
name String
role String?
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
@@unique([projectId, name])
@@index([projectId])
@@map("project_developers")
}
model SiteSettings {
id String @id @default("default")
notificationEmail String?
siteName String?
siteUrl String?
metaDescription String?
socialLinks Json?
maintenanceMode Boolean @default(false)
maintenanceMessage String?
updatedAt DateTime @updatedAt
paymentProvider String @default("stripe")
@@map("site_settings")
}
model FaqItem {
id String @id @default(cuid())
question String
answer String
order Int @default(0)
isVisible Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([isVisible])
@@map("faq_items")
}
model ServiceItem {
id String @id @default(cuid())
title String
description String
order Int @default(0)
isVisible Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([isVisible])
@@map("service_items")
}
model TeamMember {
id String @id @default(cuid())
name String
title String
description String
imageUrl String
socialLinks Json?
order Int @default(0)
isVisible Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([isVisible])
@@map("team_members")
}
model SiteSection {
id String @id @default(cuid())
key SiteSectionKey @unique
content Json
updatedAt DateTime @updatedAt
@@map("site_sections")
}
model MediaAsset {
id String @id @default(cuid())
bucket String
path String
publicUrl String
filename String
mimeType String
sizeBytes Int
alt String?
uploadedById String? @db.Uuid
createdAt DateTime @default(now())
uploadedBy User? @relation(fields: [uploadedById], references: [id], onDelete: SetNull)
@@index([createdAt])
@@index([bucket])
@@index([uploadedById])
@@map("media_assets")
}
model ActivityLog {
id String @id @default(cuid())
actorId String? @db.Uuid
actorEmail String
action String
entityType String
entityId String?
metadata Json?
createdAt DateTime @default(now())
actor User? @relation(fields: [actorId], references: [id], onDelete: SetNull)
@@index([createdAt])
@@index([entityType, entityId])
@@index([actorId])
@@map("activity_logs")
}
model Product {
id String @id @default(cuid())
name String
slug String @unique
description String
price Decimal @db.Decimal(19, 4)
fileKey String
previewUrl String?
isVisible Boolean @default(true)
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
priceMinor Decimal? @db.Decimal(19, 0)
currency String @default("usd")
lemonSqueezyVariantId String?
purchases Purchase[]
@@map("products")
}
model Purchase {
id String @id @default(cuid())
productId String
buyerName String
buyerEmail String
downloadToken String @unique
tokenUsed Boolean @default(false)
tokenExpiresAt DateTime
createdAt DateTime @default(now())
stripeSessionId String? @unique
downloadCount Int @default(0)
maxDownloads Int @default(3)
firstDownloadedAt DateTime?
downloadedAt DateTime?
stripePaymentIntentId String? @unique
stripeChargeId String?
currency String @default("usd")
amountMinor Decimal? @db.Decimal(19, 0)
emailSentAt DateTime?
revokedAt DateTime?
disputeStatus String?
buyerIp String?
userAgent String?
deliveredFileKey String?
provider String @default("stripe")
lemonSqueezyOrderId String? @unique
product Product @relation(fields: [productId], references: [id])
couponCode String?
coupon Coupon? @relation(fields: [couponCode], references: [code])
@@index([productId])
@@index([couponCode])
@@map("purchases")
}
model ProcessedPaymentEvent {
id String @id
type String
createdAt DateTime @default(now())
provider String @default("stripe")
@@map("processed_payment_events")
}
enum InquiryStatus {
NEW
IN_PROGRESS
CLOSED
}
enum EstimatorLeadStatus {
NEW
CONTACTED
CONVERTED
CLOSED
}
enum SiteSectionKey {
HERO
ABOUT
SERVICES_INTRO
TEAM_INTRO
PORTFOLIO_INTRO
TESTIMONIALS_INTRO
CTA
CONTACT
FOOTER
SEO
}
model Coupon {
code String @id
discountType String // "PERCENTAGE" | "FIXED"
discountValue Decimal @db.Decimal(19, 4)
active Boolean @default(true)
maxUses Int?
useCount Int @default(0)
expiresAt DateTime?
createdAt DateTime @default(now())
purchases Purchase[]
@@map("coupons")
}