FRE-588: Complete tRPC/Clerk integration with database schema updates

- Updated router.ts middleware for Clerk authentication
- Modified test contexts to use clerkUserId
- Added team tables to test schema
- Updated WaitlistForm and waitlist page
- Created src/server/trpc/ parallel structure

All 258 tests pass. Ready for Security Reviewer.
This commit is contained in:
2026-04-28 16:13:55 -04:00
parent 81d944b2ac
commit 0cdb2e96b1
15 changed files with 427 additions and 71 deletions

View File

@@ -111,18 +111,34 @@ CREATE TABLE IF NOT EXISTS revisions (
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS revision_changes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
revision_id INTEGER NOT NULL REFERENCES revisions(id),
change_type TEXT NOT NULL CHECK(change_type IN ('addition', 'deletion', 'modification')),
element_type TEXT,
old_content TEXT,
new_content TEXT,
scene_number INTEGER,
line_number INTEGER,
page_number INTEGER,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS revision_changes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
revision_id INTEGER NOT NULL REFERENCES revisions(id),
change_type TEXT NOT NULL CHECK(change_type IN ('addition', 'deletion', 'modification')),
element_type TEXT,
old_content TEXT,
new_content TEXT,
scene_number INTEGER,
line_number INTEGER,
page_number INTEGER,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS teams (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
owner_id INTEGER NOT NULL REFERENCES users(id),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS team_members (
id INTEGER PRIMARY KEY AUTOINCREMENT,
team_id TEXT NOT NULL REFERENCES teams(id),
user_id INTEGER NOT NULL REFERENCES users(id),
role TEXT NOT NULL DEFAULT 'editor',
joined_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
`;
export let globalSqlite: Database.Database | null = null;