Add website annotations with chart markers and CRUD management

This commit is contained in:
Mike Cao committed 2026-08-27 00:09:03 -07:00
1 parent eea124bbf8
commit 64e4cc1c3b
24 files changed
+957 -3

No files matched your search

@@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "annotation" (
"annotation_id" UUID NOT NULL,
"website_id" UUID NOT NULL,
"user_id" UUID,
"date" TIMESTAMPTZ(6) NOT NULL,
"all_day" BOOLEAN NOT NULL DEFAULT true,
"note" VARCHAR(500) NOT NULL,
"created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMPTZ(6),
CONSTRAINT "annotation_pkey" PRIMARY KEY ("annotation_id")
);
-- CreateIndex
CREATE UNIQUE INDEX "annotation_annotation_id_key" ON "annotation"("annotation_id");
-- CreateIndex
CREATE INDEX "annotation_website_id_date_idx" ON "annotation"("website_id", "date");
+17
View File
@@ -97,6 +97,7 @@ model Website {
user User? @relation("user", fields: [userId], references: [id])
createUser User? @relation("createUser", fields: [createdBy], references: [id])
team Team? @relation(fields: [teamId], references: [id])
annotations Annotation[]
eventData EventData[]
reports Report[]
revenue Revenue[]
@@ -269,6 +270,22 @@ model Report {
@@map("report")
}
model Annotation {
id String @id() @map("annotation_id") @db.Uuid
websiteId String @map("website_id") @db.Uuid
userId String? @map("user_id") @db.Uuid
date DateTime @db.Timestamptz(6)
allDay Boolean @default(true) @map("all_day")
note String @db.VarChar(500)
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
website Website @relation(fields: [websiteId], references: [id])
@@index([websiteId, date])
@@map("annotation")
}
model Segment {
id String @id() @map("segment_id") @db.Uuid
websiteId String @map("website_id") @db.Uuid