improved a lot of things

This commit is contained in:
SinachPat
2026-04-26 18:11:59 +01:00
parent ca4c0ee09a
commit 4166ffd3c1
17 changed files with 1134 additions and 19 deletions
@@ -0,0 +1,26 @@
-- Migration: 005 — projects
-- A Project groups artboards for a specific application inside a workspace.
-- Users connect their running app to a project (via app_url) and work
-- on its artboards in the canvas.
CREATE TABLE projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workspace_id UUID NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
name TEXT NOT NULL,
description TEXT,
app_url TEXT, -- e.g. https://localhost:3000 or https://staging.myapp.com
framework TEXT, -- e.g. 'react', 'next', 'vue', 'svelte'
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX projects_workspace_idx ON projects(workspace_id);
CREATE TRIGGER trg_projects_updated_at
BEFORE UPDATE ON projects
FOR EACH ROW EXECUTE FUNCTION set_updated_at();
-- Add optional project_id to artboards so artboards can be scoped to a project.
-- Nullable: existing artboards without a project remain workspace-level.
ALTER TABLE artboards ADD COLUMN IF NOT EXISTS project_id UUID REFERENCES projects(id) ON DELETE SET NULL;
CREATE INDEX IF NOT EXISTS artboards_project_idx ON artboards(project_id);
+15
View File
@@ -116,6 +116,20 @@ export const TeamMemberSchema = z.object({
});
export type TeamMember = z.infer<typeof TeamMemberSchema>;
// ── Project ───────────────────────────────────────────────────────────────────
export const ProjectSchema = z.object({
id: z.string().uuid(),
workspace_id: z.string().uuid(),
name: z.string(),
description: z.string().nullable(),
app_url: z.string().nullable(),
framework: z.string().nullable(),
created_at: z.string().datetime(),
updated_at: z.string().datetime(),
});
export type Project = z.infer<typeof ProjectSchema>;
// ── Ancestry (from materialized view) ────────────────────────────────────────
export interface ArtboardAncestry {
@@ -133,3 +147,4 @@ export type InsertIntentDiff = Omit<IntentDiff, 'id' | 'created_at' | 'updated_a
export type InsertAgentSession = Omit<AgentSession, 'id' | 'created_at' | 'updated_at'>;
export type InsertDesignLanguageFile = Omit<DesignLanguageFile, 'id' | 'created_at' | 'updated_at'>;
export type InsertTeamMember = Omit<TeamMember, 'id' | 'created_at' | 'updated_at'>;
export type InsertProject = Omit<Project, 'id' | 'created_at' | 'updated_at'>;