Description
Extend the database schema and application UI to support workspaces and team-based collaboration, allowing users to share contract analyses with their peers.
User Story
As a corporate Pro user,
I want to invite team members to my workspace and share analyses,
So that we can collaboratively review exploitative clauses and worst-case scenarios.
Technical Tasks
Database Updates
CREATE TABLE teams (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
owner_id UUID REFERENCES users(id) ON DELETE CASCADE,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE TABLE team_members (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
team_id UUID REFERENCES teams(id) ON DELETE CASCADE,
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
role TEXT NOT NULL DEFAULT 'member',
created_at TIMESTAMPTZ DEFAULT now(),
UNIQUE(team_id, user_id)
);
ALTER TABLE documents ADD COLUMN team_id UUID REFERENCES teams(id) ON DELETE SET NULL;
Description
Extend the database schema and application UI to support workspaces and team-based collaboration, allowing users to share contract analyses with their peers.
User Story
Technical Tasks
teamsandteam_memberstables in the Supabase database schema.team_idoptional foreign key column to thedocumentstable.app/(app)/contracts/page.tsxpage to display both personal and team-shared contracts.Database Updates