@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
package/package.json
CHANGED
package/prisma/app.prisma
CHANGED
|
@@ -61,15 +61,17 @@ model User {
|
|
|
61
61
|
stripeCustomer StripeCustomer? // ✨ B2C Stripe customer
|
|
62
62
|
ownedOrganizations Organization[] @relation("OrganizationOwner")
|
|
63
63
|
organizationMembers OrganizationMember[]
|
|
64
|
-
accounts
|
|
65
|
-
answers
|
|
66
|
-
conversations
|
|
67
|
-
feedbacks
|
|
68
|
-
pageViews
|
|
69
|
-
sessions
|
|
70
|
-
workflowLogs
|
|
71
|
-
verificationTokens
|
|
72
|
-
passwordResetTokens
|
|
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
|
|
@@ -175,6 +177,7 @@ model Conversation {
|
|
|
175
177
|
answers Answer[]
|
|
176
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])
|
|
@@ -199,11 +202,12 @@ model Answer {
|
|
|
199
202
|
// Relácie
|
|
200
203
|
conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
|
|
201
204
|
user User? @relation(fields: [userId], references: [id])
|
|
202
|
-
feedback
|
|
203
|
-
references
|
|
204
|
-
metrics
|
|
205
|
-
WorkflowLog
|
|
206
|
-
files
|
|
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
|
+
}
|