@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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-db68099bf6090dcfebda77a1130bfd13cc86c226f2e9eb2f7fbc7b2195f44cb6",
2
+ "name": "prisma-client-5f1a6ac2ef45658117695ac2fdcb5a13aee75ba340f90242b0e73f11b4f53f53",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "default.js",
@@ -29,47 +29,49 @@ model Account {
29
29
  }
30
30
 
31
31
  model User {
32
- id String @id @default(cuid())
33
- name String?
34
- email String? @unique
35
- emailVerified DateTime?
36
- image String?
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 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?
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 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
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 String? // Odkiaľ sa o nás dozvedel (Google, Facebook, LinkedIn, etc.)
54
- applicationText String? // Text žiadosti o prihlásenie
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 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
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 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[]
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 @id @default(cuid())
166
+ id String @id @default(cuid())
165
167
  name String
166
168
  userId String
167
- isShareable Boolean @default(false)
168
- shareUrl String? @unique
169
+ isShareable Boolean @default(false)
170
+ shareUrl String? @unique
169
171
  sharedAt DateTime?
170
- createdAt DateTime @default(now())
171
- updatedAt DateTime @updatedAt
172
+ createdAt DateTime @default(now())
173
+ updatedAt DateTime @updatedAt
172
174
  summary String?
173
- messagesSinceLastSummary Int? @default(0)
175
+ messagesSinceLastSummary Int? @default(0)
174
176
  // Relácie
175
177
  answers Answer[]
176
- user User @relation(fields: [userId], references: [id])
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 String @id @default(cuid())
186
- conversationId String
187
- messageId String @unique
188
- role Role
189
- content String
190
- question String?
191
- answer String?
192
- evaluation String?
193
- isWelcome Boolean @default(false)
194
- processingTime Int?
195
- model String?
196
- userId String?
197
- createdAt DateTime @default(now())
198
- updatedAt DateTime @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 Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
201
- user User? @relation(fields: [userId], references: [id])
202
- feedback Feedback?
203
- references Reference[]
204
- metrics AnswerMetrics?
205
- WorkflowLog WorkflowLog[]
206
- files MessageFile[]
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
+ }