@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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-db68099bf6090dcfebda77a1130bfd13cc86c226f2e9eb2f7fbc7b2195f44cb6",
2
+ "name": "prisma-client-e4999796fbd26e1c7652f5ce5325a39aeda5daffd0a5a6122011cc41af0e99b0",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "default.js",
@@ -29,47 +29,50 @@ 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
+ adminGrantExpiresAt DateTime? // Kedy admin grant expiruje
59
60
  // 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[]
61
+ approvalRequest UserApprovalRequest?
62
+ stripeCustomer StripeCustomer? // ✨ B2C Stripe customer
63
+ ownedOrganizations Organization[] @relation("OrganizationOwner")
64
+ organizationMembers OrganizationMember[]
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)
@@ -161,20 +165,21 @@ enum MemberRole {
161
165
 
162
166
  // ZJEDNODUŠENÝ Conversation - len metadata, bez duplikátov
163
167
  model Conversation {
164
- id String @id @default(cuid())
168
+ id String @id @default(cuid())
165
169
  name String
166
170
  userId String
167
- isShareable Boolean @default(false)
168
- shareUrl String? @unique
171
+ isShareable Boolean @default(false)
172
+ shareUrl String? @unique
169
173
  sharedAt DateTime?
170
- createdAt DateTime @default(now())
171
- updatedAt DateTime @updatedAt
174
+ createdAt DateTime @default(now())
175
+ updatedAt DateTime @updatedAt
172
176
  summary String?
173
- messagesSinceLastSummary Int? @default(0)
177
+ messagesSinceLastSummary Int? @default(0)
174
178
  // Relácie
175
179
  answers Answer[]
176
- user User @relation(fields: [userId], references: [id])
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])
@@ -182,28 +187,29 @@ model Conversation {
182
187
 
183
188
  // Hlavný model - všetky správy, bez duplikátov
184
189
  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
190
+ id String @id @default(cuid())
191
+ conversationId String
192
+ messageId String @unique
193
+ role Role
194
+ content String
195
+ question String?
196
+ answer String?
197
+ evaluation String?
198
+ isWelcome Boolean @default(false)
199
+ processingTime Int?
200
+ model String?
201
+ userId String?
202
+ createdAt DateTime @default(now())
203
+ updatedAt DateTime @updatedAt
199
204
  // 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[]
205
+ conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
206
+ user User? @relation(fields: [userId], references: [id])
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
+ }