@varaos/db 1.4.6 → 1.5.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
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "cloudflare_metrics" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"timestamp" TIMESTAMP(3) NOT NULL,
|
|
5
|
+
"zoneId" TEXT NOT NULL,
|
|
6
|
+
"requests" BIGINT NOT NULL DEFAULT 0,
|
|
7
|
+
"pageViews" BIGINT NOT NULL DEFAULT 0,
|
|
8
|
+
"bytes" BIGINT NOT NULL DEFAULT 0,
|
|
9
|
+
"errors4xx" INTEGER NOT NULL DEFAULT 0,
|
|
10
|
+
"errors5xx" INTEGER NOT NULL DEFAULT 0,
|
|
11
|
+
"uniqueVisitors" INTEGER NOT NULL DEFAULT 0,
|
|
12
|
+
"granularity" TEXT NOT NULL DEFAULT '1h',
|
|
13
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
14
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
15
|
+
|
|
16
|
+
CONSTRAINT "cloudflare_metrics_pkey" PRIMARY KEY ("id")
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- CreateIndex
|
|
20
|
+
CREATE UNIQUE INDEX "cloudflare_metrics_zoneId_timestamp_granularity_key" ON "cloudflare_metrics"("zoneId", "timestamp", "granularity");
|
|
21
|
+
|
|
22
|
+
-- CreateIndex
|
|
23
|
+
CREATE INDEX "cloudflare_metrics_timestamp_idx" ON "cloudflare_metrics"("timestamp");
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "public"."FeedbackType" AS ENUM ('bug_report', 'feature_request', 'general');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "public"."FeedbackStatus" AS ENUM ('open', 'in_review', 'resolved', 'closed', 'duplicate');
|
|
6
|
+
|
|
7
|
+
-- CreateTable
|
|
8
|
+
CREATE TABLE "feedback" (
|
|
9
|
+
"id" TEXT NOT NULL,
|
|
10
|
+
"userId" TEXT,
|
|
11
|
+
"type" "public"."FeedbackType" NOT NULL,
|
|
12
|
+
"status" "public"."FeedbackStatus" NOT NULL DEFAULT 'open',
|
|
13
|
+
"title" TEXT NOT NULL,
|
|
14
|
+
"description" TEXT NOT NULL,
|
|
15
|
+
"pageUrl" TEXT,
|
|
16
|
+
"userAgent" TEXT,
|
|
17
|
+
"priority" INTEGER,
|
|
18
|
+
"adminNotes" TEXT,
|
|
19
|
+
"resolvedAt" TIMESTAMP(3),
|
|
20
|
+
"metadata" JSONB,
|
|
21
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
22
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
23
|
+
|
|
24
|
+
CONSTRAINT "feedback_pkey" PRIMARY KEY ("id")
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
-- CreateIndex
|
|
28
|
+
CREATE INDEX "feedback_type_status_idx" ON "feedback"("type", "status");
|
|
29
|
+
|
|
30
|
+
-- CreateIndex
|
|
31
|
+
CREATE INDEX "feedback_userId_idx" ON "feedback"("userId");
|
|
32
|
+
|
|
33
|
+
-- CreateIndex
|
|
34
|
+
CREATE INDEX "feedback_createdAt_idx" ON "feedback"("createdAt");
|
|
35
|
+
|
|
36
|
+
-- AddForeignKey
|
|
37
|
+
ALTER TABLE "feedback" ADD CONSTRAINT "feedback_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -246,6 +246,20 @@ enum CreditPurchaseStatus {
|
|
|
246
246
|
partially_refunded
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
enum FeedbackType {
|
|
250
|
+
bug_report
|
|
251
|
+
feature_request
|
|
252
|
+
general
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
enum FeedbackStatus {
|
|
256
|
+
open
|
|
257
|
+
in_review
|
|
258
|
+
resolved
|
|
259
|
+
closed
|
|
260
|
+
duplicate
|
|
261
|
+
}
|
|
262
|
+
|
|
249
263
|
/// ─────────────────────────────────────────────────────────────
|
|
250
264
|
/// ENUMS FOR MEMORY & RAG SYSTEM
|
|
251
265
|
/// ─────────────────────────────────────────────────────────────
|
|
@@ -368,6 +382,7 @@ model User {
|
|
|
368
382
|
documents Document[]
|
|
369
383
|
|
|
370
384
|
toolRequests ToolRequest[]
|
|
385
|
+
feedbacks Feedback[]
|
|
371
386
|
|
|
372
387
|
/// Admin panel relations
|
|
373
388
|
adminSessions AdminSession[]
|
|
@@ -664,6 +679,26 @@ model UsageAggregate {
|
|
|
664
679
|
@@unique([userId, workspaceId, billingPeriod, source])
|
|
665
680
|
}
|
|
666
681
|
|
|
682
|
+
model CloudflareMetric {
|
|
683
|
+
id String @id @default(uuid())
|
|
684
|
+
timestamp DateTime
|
|
685
|
+
zoneId String
|
|
686
|
+
requests BigInt @default(0)
|
|
687
|
+
pageViews BigInt @default(0)
|
|
688
|
+
bytes BigInt @default(0)
|
|
689
|
+
errors4xx Int @default(0)
|
|
690
|
+
errors5xx Int @default(0)
|
|
691
|
+
uniqueVisitors Int @default(0)
|
|
692
|
+
granularity String @default("1h") // 1h, 1d
|
|
693
|
+
|
|
694
|
+
createdAt DateTime @default(now())
|
|
695
|
+
updatedAt DateTime @updatedAt
|
|
696
|
+
|
|
697
|
+
@@unique([zoneId, timestamp, granularity])
|
|
698
|
+
@@index([timestamp])
|
|
699
|
+
@@map("cloudflare_metrics")
|
|
700
|
+
}
|
|
701
|
+
|
|
667
702
|
model TokenTransaction {
|
|
668
703
|
id String @id @default(uuid())
|
|
669
704
|
userId String
|
|
@@ -2108,4 +2143,40 @@ model ImpersonationSession {
|
|
|
2108
2143
|
|
|
2109
2144
|
@@index([actorId])
|
|
2110
2145
|
@@index([targetId])
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
/// ─────────────────────────────────────────────────────────────
|
|
2149
|
+
/// FEEDBACK (Bug Reports & Feature Requests)
|
|
2150
|
+
/// ─────────────────────────────────────────────────────────────
|
|
2151
|
+
|
|
2152
|
+
model Feedback {
|
|
2153
|
+
id String @id @default(uuid())
|
|
2154
|
+
userId String? // nullable — allows anonymous submissions
|
|
2155
|
+
|
|
2156
|
+
type FeedbackType
|
|
2157
|
+
status FeedbackStatus @default(open)
|
|
2158
|
+
|
|
2159
|
+
title String
|
|
2160
|
+
description String @db.Text
|
|
2161
|
+
|
|
2162
|
+
/// Captured automatically on submission
|
|
2163
|
+
pageUrl String?
|
|
2164
|
+
userAgent String?
|
|
2165
|
+
|
|
2166
|
+
/// Admin-side fields
|
|
2167
|
+
priority Int? // 1-5
|
|
2168
|
+
adminNotes String? @db.Text
|
|
2169
|
+
resolvedAt DateTime?
|
|
2170
|
+
|
|
2171
|
+
metadata Json?
|
|
2172
|
+
|
|
2173
|
+
createdAt DateTime @default(now())
|
|
2174
|
+
updatedAt DateTime @updatedAt
|
|
2175
|
+
|
|
2176
|
+
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
2177
|
+
|
|
2178
|
+
@@index([type, status])
|
|
2179
|
+
@@index([userId])
|
|
2180
|
+
@@index([createdAt])
|
|
2181
|
+
@@map("feedback")
|
|
2111
2182
|
}
|