@varaos/db 1.1.15 → 1.1.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varaos/db",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,3 @@
1
+ -- AlterTable
2
+ ALTER TABLE "public"."User" ADD COLUMN "storageLimit" BIGINT NOT NULL DEFAULT 524288000,
3
+ ADD COLUMN "storageUsed" BIGINT NOT NULL DEFAULT 0;
@@ -0,0 +1,21 @@
1
+ -- CreateTable
2
+ CREATE TABLE "public"."UserFile" (
3
+ "id" TEXT NOT NULL,
4
+ "userId" TEXT NOT NULL,
5
+ "path" TEXT NOT NULL,
6
+ "size" BIGINT NOT NULL,
7
+ "mimeType" TEXT NOT NULL,
8
+ "category" TEXT NOT NULL,
9
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
10
+
11
+ CONSTRAINT "UserFile_pkey" PRIMARY KEY ("id")
12
+ );
13
+
14
+ -- CreateIndex
15
+ CREATE INDEX "UserFile_userId_idx" ON "public"."UserFile"("userId");
16
+
17
+ -- CreateIndex
18
+ CREATE INDEX "UserFile_category_idx" ON "public"."UserFile"("category");
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "public"."UserFile" ADD CONSTRAINT "UserFile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,3 @@
1
+ -- AlterTable
2
+ ALTER TABLE "public"."UserFile" ADD COLUMN "checksum" TEXT,
3
+ ADD COLUMN "metadata" JSONB;
@@ -101,6 +101,9 @@ model User {
101
101
 
102
102
  passwordStrength String? // weak | medium | strong
103
103
 
104
+ storageUsed BigInt @default(0) // bytes
105
+ storageLimit BigInt @default(524288000) // 500 MB (beta)
106
+
104
107
  accounts Account[]
105
108
  integrations Integration[]
106
109
  tokenTransactions TokenTransaction[]
@@ -121,10 +124,31 @@ model User {
121
124
  paymentMethods PaymentMethod[]
122
125
  userEmails UserEmail[]
123
126
  invoices Invoice[]
127
+ userFiles UserFile[]
124
128
 
125
129
  @@index([status])
126
130
  }
127
131
 
132
+ model UserFile {
133
+ id String @id @default(uuid())
134
+ userId String
135
+
136
+ path String // local path or CDN URL
137
+ size BigInt // bytes
138
+ mimeType String
139
+ category String // avatar | memory | export | attachment
140
+
141
+ checksum String? // sha256 or md5 for integrity verification
142
+ metadata Json?
143
+
144
+ createdAt DateTime @default(now())
145
+
146
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
147
+
148
+ @@index([userId])
149
+ @@index([category])
150
+ }
151
+
128
152
  model UserSession {
129
153
  id String @id @default(uuid())
130
154
  userId String
@@ -132,7 +156,7 @@ model UserSession {
132
156
  userAgent String?
133
157
  lastUsed DateTime
134
158
 
135
- revoked Boolean @default(false)
159
+ revoked Boolean @default(false)
136
160
  revokedAt DateTime?
137
161
 
138
162
  expiresAt DateTime
@@ -645,11 +669,11 @@ model Invoice {
645
669
  }
646
670
 
647
671
  model BillingEvent {
648
- id String @id @default(uuid())
649
- provider String // razorpay
672
+ id String @id @default(uuid())
673
+ provider String // razorpay
650
674
 
651
675
  eventType String
652
- eventId String @unique // razorpay event ID
676
+ eventId String @unique // razorpay event ID
653
677
 
654
678
  payload Json
655
679
  processed Boolean @default(false)
@@ -661,7 +685,7 @@ model BillingEvent {
661
685
  model PaymentMethod {
662
686
  id String @id @default(uuid())
663
687
  userId String
664
- provider String // razorpay | stripe | paypal
688
+ provider String // razorpay | stripe | paypal
665
689
  type String // card
666
690
  brand String?
667
691
  last4 String?