@danielcok17/prisma-db 1.5.0 → 1.7.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 +78 -14
- package/prisma/generated/app/edge.js +42 -6
- package/prisma/generated/app/index-browser.js +38 -3
- package/prisma/generated/app/index.d.ts +7905 -2678
- package/prisma/generated/app/index.js +42 -6
- package/prisma/generated/app/package.json +1 -1
- package/prisma/generated/app/schema.prisma +128 -64
- package/prisma/generated/app/wasm.js +42 -6
- package/prisma/migrations/20260110200252_add_canvas_documents/migration.sql +80 -0
- package/prisma/migrations/20260113150746_add_admin_grant_expiration/migration.sql +5 -0
package/package.json
CHANGED
package/prisma/app.prisma
CHANGED
|
@@ -56,20 +56,23 @@ model User {
|
|
|
56
56
|
subscriptionTier SubscriptionTier @default(FREE) // Aktuálny subscription tier (cache)
|
|
57
57
|
messageCount Int @default(10) // ✅ OPRAVENÉ z 100 na 10
|
|
58
58
|
messageCountResetAt DateTime? // Kedy sa má resetovať message count
|
|
59
|
+
adminGrantExpiresAt DateTime? // Kedy admin grant expiruje
|
|
59
60
|
// Relations
|
|
60
61
|
approvalRequest UserApprovalRequest?
|
|
61
62
|
stripeCustomer StripeCustomer? // ✨ B2C Stripe customer
|
|
62
63
|
ownedOrganizations Organization[] @relation("OrganizationOwner")
|
|
63
64
|
organizationMembers OrganizationMember[]
|
|
64
|
-
accounts
|
|
65
|
-
answers
|
|
66
|
-
conversations
|
|
67
|
-
feedbacks
|
|
68
|
-
pageViews
|
|
69
|
-
sessions
|
|
70
|
-
workflowLogs
|
|
71
|
-
verificationTokens
|
|
72
|
-
passwordResetTokens
|
|
65
|
+
accounts Account[]
|
|
66
|
+
answers Answer[]
|
|
67
|
+
conversations Conversation[]
|
|
68
|
+
feedbacks Feedback[]
|
|
69
|
+
pageViews PageView[]
|
|
70
|
+
sessions Session[]
|
|
71
|
+
workflowLogs WorkflowLog[]
|
|
72
|
+
verificationTokens VerificationToken[]
|
|
73
|
+
passwordResetTokens PasswordResetToken[]
|
|
74
|
+
canvasDocuments CanvasDocument[]
|
|
75
|
+
canvasDocumentVersions CanvasDocumentVersion[]
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
// Nový model pre žiadosti o schválenie
|
|
@@ -115,6 +118,7 @@ model Organization {
|
|
|
115
118
|
messageCount Int @default(0) // Spoločný pool správ pre všetkých členov
|
|
116
119
|
messageLimit Int @default(100) // Limit správ podľa tieru
|
|
117
120
|
messageCountResetAt DateTime? // Kedy sa má resetovať pool
|
|
121
|
+
adminGrantExpiresAt DateTime? // Kedy admin grant expiruje
|
|
118
122
|
|
|
119
123
|
// Settings
|
|
120
124
|
isActive Boolean @default(true)
|
|
@@ -175,6 +179,7 @@ model Conversation {
|
|
|
175
179
|
answers Answer[]
|
|
176
180
|
user User @relation(fields: [userId], references: [id])
|
|
177
181
|
workflowLogs WorkflowLog[]
|
|
182
|
+
canvasDocuments CanvasDocument[]
|
|
178
183
|
|
|
179
184
|
@@index([userId])
|
|
180
185
|
@@index([createdAt])
|
|
@@ -199,11 +204,12 @@ model Answer {
|
|
|
199
204
|
// Relácie
|
|
200
205
|
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
|
|
201
206
|
user User? @relation(fields: [userId], references: [id])
|
|
202
|
-
feedback
|
|
203
|
-
references
|
|
204
|
-
metrics
|
|
205
|
-
WorkflowLog
|
|
206
|
-
files
|
|
207
|
+
feedback Feedback?
|
|
208
|
+
references Reference[]
|
|
209
|
+
metrics AnswerMetrics?
|
|
210
|
+
WorkflowLog WorkflowLog[]
|
|
211
|
+
files MessageFile[]
|
|
212
|
+
canvasDocumentId String? // No FK constraint - flexible document management
|
|
207
213
|
|
|
208
214
|
@@index([conversationId])
|
|
209
215
|
@@index([messageId])
|
|
@@ -529,6 +535,13 @@ enum BillingInterval {
|
|
|
529
535
|
YEARLY // Yearly billing (17% discount)
|
|
530
536
|
}
|
|
531
537
|
|
|
538
|
+
// Canvas Document Status
|
|
539
|
+
enum DocumentStatus {
|
|
540
|
+
DRAFT
|
|
541
|
+
SAVED
|
|
542
|
+
ARCHIVED
|
|
543
|
+
}
|
|
544
|
+
|
|
532
545
|
// Nový model pre logovanie admin akcií
|
|
533
546
|
model AdminActionLog {
|
|
534
547
|
id String @id @default(cuid())
|
|
@@ -644,3 +657,54 @@ model PasswordResetToken {
|
|
|
644
657
|
@@index([userId])
|
|
645
658
|
@@index([expires])
|
|
646
659
|
}
|
|
660
|
+
|
|
661
|
+
// ============================================
|
|
662
|
+
// CANVAS DOCUMENT MODELS
|
|
663
|
+
// ============================================
|
|
664
|
+
|
|
665
|
+
model CanvasDocument {
|
|
666
|
+
id String @id @default(cuid())
|
|
667
|
+
userId String
|
|
668
|
+
title String
|
|
669
|
+
status DocumentStatus @default(DRAFT)
|
|
670
|
+
createdAt DateTime @default(now())
|
|
671
|
+
updatedAt DateTime @updatedAt
|
|
672
|
+
originConversationId String?
|
|
673
|
+
originAnswerId String? // No FK constraint - async save reference
|
|
674
|
+
currentVersionId String? @unique
|
|
675
|
+
|
|
676
|
+
// Relations
|
|
677
|
+
user User @relation(fields: [userId], references: [id], onDelete: Restrict)
|
|
678
|
+
originConversation Conversation? @relation(fields: [originConversationId], references: [id], onDelete: SetNull)
|
|
679
|
+
currentVersion CanvasDocumentVersion? @relation("CurrentVersion", fields: [currentVersionId], references: [id], onDelete: SetNull)
|
|
680
|
+
versions CanvasDocumentVersion[] @relation("DocumentVersions")
|
|
681
|
+
|
|
682
|
+
@@index([userId])
|
|
683
|
+
@@index([originConversationId])
|
|
684
|
+
@@index([status])
|
|
685
|
+
@@index([createdAt])
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
model CanvasDocumentVersion {
|
|
689
|
+
id String @id @default(cuid())
|
|
690
|
+
documentId String
|
|
691
|
+
versionNumber Int
|
|
692
|
+
title String
|
|
693
|
+
markdownContent String
|
|
694
|
+
createdAt DateTime @default(now())
|
|
695
|
+
createdBy String
|
|
696
|
+
regenerationPrompt String?
|
|
697
|
+
parentVersionId String?
|
|
698
|
+
|
|
699
|
+
// Relations
|
|
700
|
+
document CanvasDocument @relation("DocumentVersions", fields: [documentId], references: [id], onDelete: Cascade)
|
|
701
|
+
creator User @relation(fields: [createdBy], references: [id], onDelete: Restrict)
|
|
702
|
+
parentVersion CanvasDocumentVersion? @relation("VersionHistory", fields: [parentVersionId], references: [id], onDelete: SetNull)
|
|
703
|
+
childVersions CanvasDocumentVersion[] @relation("VersionHistory")
|
|
704
|
+
currentForDocument CanvasDocument? @relation("CurrentVersion")
|
|
705
|
+
|
|
706
|
+
@@unique([documentId, versionNumber])
|
|
707
|
+
@@index([documentId])
|
|
708
|
+
@@index([createdBy])
|
|
709
|
+
@@index([createdAt])
|
|
710
|
+
}
|