From 7edddf15a7cfe27b63b002d46581a7766b758dd3 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 28 Nov 2025 00:37:51 -0800 Subject: [PATCH] Boards schema. --- pnpm-lock.yaml | 48 +++++++++++++++++++++++ prisma/migrations/15_boards/migration.sql | 33 ++++++++++++++++ prisma/schema.prisma | 24 ++++++++++++ src/app/(main)/SideNav.tsx | 8 +++- 4 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/15_boards/migration.sql diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0a4577c16..16b8ab668 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -328,6 +328,45 @@ importers: specifier: ^5.9.3 version: 5.9.3 + dist: + dependencies: + chart.js: + specifier: ^4.5.0 + version: 4.5.1 + chartjs-adapter-date-fns: + specifier: ^3.0.0 + version: 3.0.0(chart.js@4.5.1)(date-fns@2.30.0) + colord: + specifier: ^2.9.2 + version: 2.9.3 + jsonwebtoken: + specifier: ^9.0.2 + version: 9.0.2 + lucide-react: + specifier: ^0.542.0 + version: 0.542.0(react@19.2.0) + pure-rand: + specifier: ^7.0.1 + version: 7.0.1 + react-simple-maps: + specifier: ^2.3.0 + version: 2.3.0(prop-types@15.8.1)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + react-use-measure: + specifier: ^2.0.4 + version: 2.1.7(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + react-window: + specifier: ^1.8.6 + version: 1.8.11(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + serialize-error: + specifier: ^12.0.0 + version: 12.0.0 + thenby: + specifier: ^1.3.4 + version: 1.3.4 + uuid: + specifier: ^11.1.0 + version: 11.1.0 + packages: '@ampproject/remapping@2.3.0': @@ -5047,6 +5086,11 @@ packages: peerDependencies: react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + lucide-react@0.542.0: + resolution: {integrity: sha512-w3hD8/SQB7+lzU2r4VdFyzzOzKnUjTZIF/MQJGSSvni7Llewni4vuViRppfRAa2guOsY5k4jZyxw/i9DQHv+dw==} + peerDependencies: + react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + lucide-react@0.543.0: resolution: {integrity: sha512-fpVfuOQO0V3HBaOA1stIiP/A2fPCXHIleRZL16Mx3HmjTYwNSbimhnFBygs2CAfU1geexMX5ItUcWBGUaqw5CA==} peerDependencies: @@ -12656,6 +12700,10 @@ snapshots: dependencies: react: 19.2.0 + lucide-react@0.542.0(react@19.2.0): + dependencies: + react: 19.2.0 + lucide-react@0.543.0(react@19.2.0): dependencies: react: 19.2.0 diff --git a/prisma/migrations/15_boards/migration.sql b/prisma/migrations/15_boards/migration.sql new file mode 100644 index 000000000..09608c5fd --- /dev/null +++ b/prisma/migrations/15_boards/migration.sql @@ -0,0 +1,33 @@ +-- CreateTable +CREATE TABLE "board" ( + "board_id" UUID NOT NULL, + "type" VARCHAR(50) NOT NULL, + "name" VARCHAR(200) NOT NULL, + "description" VARCHAR(500) NOT NULL, + "parameters" JSONB NOT NULL, + "slug" VARCHAR(100) NOT NULL, + "user_id" UUID, + "team_id" UUID, + "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMPTZ(6), + + CONSTRAINT "board_pkey" PRIMARY KEY ("board_id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "board_board_id_key" ON "board"("board_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "board_slug_key" ON "board"("slug"); + +-- CreateIndex +CREATE INDEX "board_slug_idx" ON "board"("slug"); + +-- CreateIndex +CREATE INDEX "board_user_id_idx" ON "board"("user_id"); + +-- CreateIndex +CREATE INDEX "board_team_id_idx" ON "board"("team_id"); + +-- CreateIndex +CREATE INDEX "board_created_at_idx" ON "board"("created_at"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index aeb11648d..c0c03784d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -27,6 +27,7 @@ model User { pixels Pixel[] @relation("user") teams TeamUser[] reports Report[] + boards Board[] @relation("user") @@map("user") } @@ -199,6 +200,7 @@ model Team { members TeamUser[] links Link[] pixels Pixel[] + boards Board[] @@index([accessCode]) @@map("team") @@ -316,3 +318,25 @@ model Pixel { @@index([createdAt]) @@map("pixel") } + +model Board { + id String @id() @unique() @map("board_id") @db.Uuid + type String @db.VarChar(50) + name String @db.VarChar(200) + description String @db.VarChar(500) + parameters Json + slug String @unique() @db.VarChar(100) + userId String? @map("user_id") @db.Uuid + teamId String? @map("team_id") @db.Uuid + createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6) + updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) + + user User? @relation("user", fields: [userId], references: [id]) + team Team? @relation(fields: [teamId], references: [id]) + + @@index([slug]) + @@index([userId]) + @@index([teamId]) + @@index([createdAt]) + @@map("board") +} diff --git a/src/app/(main)/SideNav.tsx b/src/app/(main)/SideNav.tsx index 1ecb58dbc..73d598990 100644 --- a/src/app/(main)/SideNav.tsx +++ b/src/app/(main)/SideNav.tsx @@ -10,7 +10,7 @@ import { import Link from 'next/link'; import type { Key } from 'react'; import { useGlobalState, useMessages, useNavigation } from '@/components/hooks'; -import { Globe, Grid2x2, LinkIcon, PanelLeft } from '@/components/icons'; +import { Globe, Grid2x2, LayoutDashboard, LinkIcon, PanelLeft } from '@/components/icons'; import { LanguageButton } from '@/components/input/LanguageButton'; import { NavButton } from '@/components/input/NavButton'; import { PanelButton } from '@/components/input/PanelButton'; @@ -24,6 +24,12 @@ export function SideNav(props: SidebarProps) { const hasNav = !!(websiteId || pathname.startsWith('/admin') || pathname.includes('/settings')); const links = [ + { + id: 'boards', + label: formatMessage(labels.boards), + path: '/boards', + icon: , + }, { id: 'websites', label: formatMessage(labels.websites),