@danielcok17/prisma-db 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/prisma/app.prisma +76 -14
- package/prisma/generated/app/edge.js +39 -5
- package/prisma/generated/app/index-browser.js +35 -2
- package/prisma/generated/app/index.d.ts +7769 -2675
- package/prisma/generated/app/index.js +39 -5
- package/prisma/generated/app/package.json +1 -1
- package/prisma/generated/app/schema.prisma +126 -64
- package/prisma/generated/app/wasm.js +39 -5
- package/prisma/migrations/20260110200252_add_canvas_documents/migration.sql +80 -0
|
@@ -29,47 +29,49 @@ model Account {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
model User {
|
|
32
|
-
id
|
|
33
|
-
name
|
|
34
|
-
email
|
|
35
|
-
emailVerified
|
|
36
|
-
image
|
|
32
|
+
id String @id @default(cuid())
|
|
33
|
+
name String?
|
|
34
|
+
email String? @unique
|
|
35
|
+
emailVerified DateTime?
|
|
36
|
+
image String?
|
|
37
37
|
// Credentials authentication fields
|
|
38
|
-
password
|
|
39
|
-
createdAt
|
|
40
|
-
agreedToTerms
|
|
41
|
-
practiceArea
|
|
42
|
-
lawFirm
|
|
43
|
-
yearsOfExperience
|
|
38
|
+
password String? // Hashed password pre credentials login
|
|
39
|
+
createdAt DateTime @default(now())
|
|
40
|
+
agreedToTerms Boolean @default(false)
|
|
41
|
+
practiceArea String[]
|
|
42
|
+
lawFirm String?
|
|
43
|
+
yearsOfExperience Int?
|
|
44
44
|
// Nové polia pre schvalovanie používateľov
|
|
45
|
-
isApproved
|
|
46
|
-
isRejected
|
|
47
|
-
approvedAt
|
|
48
|
-
rejectedAt
|
|
49
|
-
approvedBy
|
|
50
|
-
rejectedBy
|
|
51
|
-
rejectionReason
|
|
45
|
+
isApproved Boolean @default(false) // Či je používateľ schválený
|
|
46
|
+
isRejected Boolean @default(false) // Či je používateľ zamietnutý
|
|
47
|
+
approvedAt DateTime? // Kedy bol schválený
|
|
48
|
+
rejectedAt DateTime? // Kedy bol zamietnutý
|
|
49
|
+
approvedBy String? // ID admina, ktorý schválil
|
|
50
|
+
rejectedBy String? // ID admina, ktorý zamietol
|
|
51
|
+
rejectionReason String? // Dôvod zamietnutia
|
|
52
52
|
// Nové polia pre tracking a žiadosť
|
|
53
|
-
referralSource
|
|
54
|
-
applicationText
|
|
53
|
+
referralSource String? // Odkiaľ sa o nás dozvedel (Google, Facebook, LinkedIn, etc.)
|
|
54
|
+
applicationText String? // Text žiadosti o prihlásenie
|
|
55
55
|
// ✨ STRIPE FIELDS (B2C - len pre individuálnych používateľov)
|
|
56
|
-
subscriptionTier
|
|
57
|
-
messageCount
|
|
58
|
-
messageCountResetAt
|
|
56
|
+
subscriptionTier SubscriptionTier @default(FREE) // Aktuálny subscription tier (cache)
|
|
57
|
+
messageCount Int @default(10) // ✅ OPRAVENÉ z 100 na 10
|
|
58
|
+
messageCountResetAt DateTime? // Kedy sa má resetovať message count
|
|
59
59
|
// Relations
|
|
60
|
-
approvalRequest
|
|
61
|
-
stripeCustomer
|
|
62
|
-
ownedOrganizations
|
|
63
|
-
organizationMembers
|
|
64
|
-
accounts
|
|
65
|
-
answers
|
|
66
|
-
conversations
|
|
67
|
-
feedbacks
|
|
68
|
-
pageViews
|
|
69
|
-
sessions
|
|
70
|
-
workflowLogs
|
|
71
|
-
verificationTokens
|
|
72
|
-
passwordResetTokens
|
|
60
|
+
approvalRequest UserApprovalRequest?
|
|
61
|
+
stripeCustomer StripeCustomer? // ✨ B2C Stripe customer
|
|
62
|
+
ownedOrganizations Organization[] @relation("OrganizationOwner")
|
|
63
|
+
organizationMembers OrganizationMember[]
|
|
64
|
+
accounts Account[]
|
|
65
|
+
answers Answer[]
|
|
66
|
+
conversations Conversation[]
|
|
67
|
+
feedbacks Feedback[]
|
|
68
|
+
pageViews PageView[]
|
|
69
|
+
sessions Session[]
|
|
70
|
+
workflowLogs WorkflowLog[]
|
|
71
|
+
verificationTokens VerificationToken[]
|
|
72
|
+
passwordResetTokens PasswordResetToken[]
|
|
73
|
+
canvasDocuments CanvasDocument[]
|
|
74
|
+
canvasDocumentVersions CanvasDocumentVersion[]
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
// Nový model pre žiadosti o schválenie
|
|
@@ -161,20 +163,21 @@ enum MemberRole {
|
|
|
161
163
|
|
|
162
164
|
// ZJEDNODUŠENÝ Conversation - len metadata, bez duplikátov
|
|
163
165
|
model Conversation {
|
|
164
|
-
id String
|
|
166
|
+
id String @id @default(cuid())
|
|
165
167
|
name String
|
|
166
168
|
userId String
|
|
167
|
-
isShareable Boolean
|
|
168
|
-
shareUrl String?
|
|
169
|
+
isShareable Boolean @default(false)
|
|
170
|
+
shareUrl String? @unique
|
|
169
171
|
sharedAt DateTime?
|
|
170
|
-
createdAt DateTime
|
|
171
|
-
updatedAt DateTime
|
|
172
|
+
createdAt DateTime @default(now())
|
|
173
|
+
updatedAt DateTime @updatedAt
|
|
172
174
|
summary String?
|
|
173
|
-
messagesSinceLastSummary Int?
|
|
175
|
+
messagesSinceLastSummary Int? @default(0)
|
|
174
176
|
// Relácie
|
|
175
177
|
answers Answer[]
|
|
176
|
-
user User
|
|
178
|
+
user User @relation(fields: [userId], references: [id])
|
|
177
179
|
workflowLogs WorkflowLog[]
|
|
180
|
+
canvasDocuments CanvasDocument[]
|
|
178
181
|
|
|
179
182
|
@@index([userId])
|
|
180
183
|
@@index([createdAt])
|
|
@@ -182,28 +185,29 @@ model Conversation {
|
|
|
182
185
|
|
|
183
186
|
// Hlavný model - všetky správy, bez duplikátov
|
|
184
187
|
model Answer {
|
|
185
|
-
id
|
|
186
|
-
conversationId
|
|
187
|
-
messageId
|
|
188
|
-
role
|
|
189
|
-
content
|
|
190
|
-
question
|
|
191
|
-
answer
|
|
192
|
-
evaluation
|
|
193
|
-
isWelcome
|
|
194
|
-
processingTime
|
|
195
|
-
model
|
|
196
|
-
userId
|
|
197
|
-
createdAt
|
|
198
|
-
updatedAt
|
|
188
|
+
id String @id @default(cuid())
|
|
189
|
+
conversationId String
|
|
190
|
+
messageId String @unique
|
|
191
|
+
role Role
|
|
192
|
+
content String
|
|
193
|
+
question String?
|
|
194
|
+
answer String?
|
|
195
|
+
evaluation String?
|
|
196
|
+
isWelcome Boolean @default(false)
|
|
197
|
+
processingTime Int?
|
|
198
|
+
model String?
|
|
199
|
+
userId String?
|
|
200
|
+
createdAt DateTime @default(now())
|
|
201
|
+
updatedAt DateTime @updatedAt
|
|
199
202
|
// Relácie
|
|
200
|
-
conversation
|
|
201
|
-
user
|
|
202
|
-
feedback
|
|
203
|
-
references
|
|
204
|
-
metrics
|
|
205
|
-
WorkflowLog
|
|
206
|
-
files
|
|
203
|
+
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
|
|
204
|
+
user User? @relation(fields: [userId], references: [id])
|
|
205
|
+
feedback Feedback?
|
|
206
|
+
references Reference[]
|
|
207
|
+
metrics AnswerMetrics?
|
|
208
|
+
WorkflowLog WorkflowLog[]
|
|
209
|
+
files MessageFile[]
|
|
210
|
+
canvasDocumentId String? // No FK constraint - flexible document management
|
|
207
211
|
|
|
208
212
|
@@index([conversationId])
|
|
209
213
|
@@index([messageId])
|
|
@@ -529,6 +533,13 @@ enum BillingInterval {
|
|
|
529
533
|
YEARLY // Yearly billing (17% discount)
|
|
530
534
|
}
|
|
531
535
|
|
|
536
|
+
// Canvas Document Status
|
|
537
|
+
enum DocumentStatus {
|
|
538
|
+
DRAFT
|
|
539
|
+
SAVED
|
|
540
|
+
ARCHIVED
|
|
541
|
+
}
|
|
542
|
+
|
|
532
543
|
// Nový model pre logovanie admin akcií
|
|
533
544
|
model AdminActionLog {
|
|
534
545
|
id String @id @default(cuid())
|
|
@@ -644,3 +655,54 @@ model PasswordResetToken {
|
|
|
644
655
|
@@index([userId])
|
|
645
656
|
@@index([expires])
|
|
646
657
|
}
|
|
658
|
+
|
|
659
|
+
// ============================================
|
|
660
|
+
// CANVAS DOCUMENT MODELS
|
|
661
|
+
// ============================================
|
|
662
|
+
|
|
663
|
+
model CanvasDocument {
|
|
664
|
+
id String @id @default(cuid())
|
|
665
|
+
userId String
|
|
666
|
+
title String
|
|
667
|
+
status DocumentStatus @default(DRAFT)
|
|
668
|
+
createdAt DateTime @default(now())
|
|
669
|
+
updatedAt DateTime @updatedAt
|
|
670
|
+
originConversationId String?
|
|
671
|
+
originAnswerId String? // No FK constraint - async save reference
|
|
672
|
+
currentVersionId String? @unique
|
|
673
|
+
|
|
674
|
+
// Relations
|
|
675
|
+
user User @relation(fields: [userId], references: [id], onDelete: Restrict)
|
|
676
|
+
originConversation Conversation? @relation(fields: [originConversationId], references: [id], onDelete: SetNull)
|
|
677
|
+
currentVersion CanvasDocumentVersion? @relation("CurrentVersion", fields: [currentVersionId], references: [id], onDelete: SetNull)
|
|
678
|
+
versions CanvasDocumentVersion[] @relation("DocumentVersions")
|
|
679
|
+
|
|
680
|
+
@@index([userId])
|
|
681
|
+
@@index([originConversationId])
|
|
682
|
+
@@index([status])
|
|
683
|
+
@@index([createdAt])
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
model CanvasDocumentVersion {
|
|
687
|
+
id String @id @default(cuid())
|
|
688
|
+
documentId String
|
|
689
|
+
versionNumber Int
|
|
690
|
+
title String
|
|
691
|
+
markdownContent String
|
|
692
|
+
createdAt DateTime @default(now())
|
|
693
|
+
createdBy String
|
|
694
|
+
regenerationPrompt String?
|
|
695
|
+
parentVersionId String?
|
|
696
|
+
|
|
697
|
+
// Relations
|
|
698
|
+
document CanvasDocument @relation("DocumentVersions", fields: [documentId], references: [id], onDelete: Cascade)
|
|
699
|
+
creator User @relation(fields: [createdBy], references: [id], onDelete: Restrict)
|
|
700
|
+
parentVersion CanvasDocumentVersion? @relation("VersionHistory", fields: [parentVersionId], references: [id], onDelete: SetNull)
|
|
701
|
+
childVersions CanvasDocumentVersion[] @relation("VersionHistory")
|
|
702
|
+
currentForDocument CanvasDocument? @relation("CurrentVersion")
|
|
703
|
+
|
|
704
|
+
@@unique([documentId, versionNumber])
|
|
705
|
+
@@index([documentId])
|
|
706
|
+
@@index([createdBy])
|
|
707
|
+
@@index([createdAt])
|
|
708
|
+
}
|