@danielcok17/prisma-db 1.6.0 → 1.8.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 +35 -5
- package/prisma/generated/app/edge.js +24 -4
- package/prisma/generated/app/index-browser.js +21 -1
- package/prisma/generated/app/index.d.ts +2901 -303
- package/prisma/generated/app/index.js +24 -4
- package/prisma/generated/app/package.json +1 -1
- package/prisma/generated/app/schema.prisma +30 -0
- package/prisma/generated/app/wasm.js +24 -4
- package/prisma/migrations/20260113150746_add_admin_grant_expiration/migration.sql +5 -0
- package/prisma/migrations/20260113205726_add_organization_invite/migration.sql +40 -0
package/package.json
CHANGED
package/prisma/app.prisma
CHANGED
|
@@ -56,11 +56,13 @@ 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
|
-
approvalRequest
|
|
61
|
-
stripeCustomer
|
|
62
|
-
ownedOrganizations
|
|
63
|
-
organizationMembers
|
|
61
|
+
approvalRequest UserApprovalRequest?
|
|
62
|
+
stripeCustomer StripeCustomer? // ✨ B2C Stripe customer
|
|
63
|
+
ownedOrganizations Organization[] @relation("OrganizationOwner")
|
|
64
|
+
organizationMembers OrganizationMember[]
|
|
65
|
+
createdInvites OrganizationInvite[] @relation("InviteCreator")
|
|
64
66
|
accounts Account[]
|
|
65
67
|
answers Answer[]
|
|
66
68
|
conversations Conversation[]
|
|
@@ -117,15 +119,17 @@ model Organization {
|
|
|
117
119
|
messageCount Int @default(0) // Spoločný pool správ pre všetkých členov
|
|
118
120
|
messageLimit Int @default(100) // Limit správ podľa tieru
|
|
119
121
|
messageCountResetAt DateTime? // Kedy sa má resetovať pool
|
|
122
|
+
adminGrantExpiresAt DateTime? // Kedy admin grant expiruje
|
|
120
123
|
|
|
121
124
|
// Settings
|
|
122
125
|
isActive Boolean @default(true)
|
|
123
126
|
maxMembers Int @default(5) // Max počet členov podľa tieru
|
|
124
127
|
|
|
125
128
|
// Relations
|
|
126
|
-
owner User
|
|
129
|
+
owner User @relation("OrganizationOwner", fields: [ownerId], references: [id])
|
|
127
130
|
ownerId String
|
|
128
131
|
members OrganizationMember[]
|
|
132
|
+
invites OrganizationInvite[]
|
|
129
133
|
stripeCustomer StripeCustomer?
|
|
130
134
|
|
|
131
135
|
createdAt DateTime @default(now())
|
|
@@ -155,6 +159,32 @@ model OrganizationMember {
|
|
|
155
159
|
@@index([role])
|
|
156
160
|
}
|
|
157
161
|
|
|
162
|
+
// Organization Invite System
|
|
163
|
+
model OrganizationInvite {
|
|
164
|
+
id String @id @default(cuid())
|
|
165
|
+
organizationId String
|
|
166
|
+
token String @unique
|
|
167
|
+
email String? // Optional: specific email invite
|
|
168
|
+
role MemberRole @default(MEMBER)
|
|
169
|
+
createdBy String
|
|
170
|
+
expiresAt DateTime
|
|
171
|
+
maxUses Int @default(1) // For multi-use invites
|
|
172
|
+
currentUses Int @default(0)
|
|
173
|
+
isActive Boolean @default(true)
|
|
174
|
+
usedAt DateTime? // Last usage timestamp
|
|
175
|
+
usedBy String? // Last user who used it
|
|
176
|
+
createdAt DateTime @default(now())
|
|
177
|
+
updatedAt DateTime @updatedAt
|
|
178
|
+
|
|
179
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
180
|
+
creator User @relation("InviteCreator", fields: [createdBy], references: [id])
|
|
181
|
+
|
|
182
|
+
@@index([token])
|
|
183
|
+
@@index([organizationId])
|
|
184
|
+
@@index([isActive])
|
|
185
|
+
@@index([expiresAt])
|
|
186
|
+
}
|
|
187
|
+
|
|
158
188
|
enum MemberRole {
|
|
159
189
|
OWNER // Zakladateľ/vlastník, plný prístup k billing a settings
|
|
160
190
|
ADMIN // Administrátor, môže pridávať/odoberať členov
|