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

@@ -25,7 +25,7 @@ describe('tRPC API Layer', () => {
expect(project).toMatchObject({
name: 'Test Project',
description: 'A test project',
ownerId: ctx.userId,
ownerId: 1,
});
expect(project.id).toBeDefined();
expect(project.id).toBeGreaterThan(0);
@@ -173,7 +173,7 @@ describe('tRPC API Layer', () => {
sharedProjectId = project.id;
// Insert a second user
globalSqlite!.exec("INSERT INTO users (id, email, name) VALUES (2, 'user2@test.com', 'User Two');");
globalSqlite!.exec("INSERT INTO users (id, clerk_id, email, name) VALUES (2, 'user2_test', 'user2@test.com', 'User Two');");
});
it('should share a project with another user', async () => {
@@ -276,7 +276,7 @@ describe('tRPC API Layer', () => {
// Create caller for user 2
const db = await getTestDb();
const ctx2: TRPCContext = { userId: 2, db };
const ctx2: TRPCContext = { clerkUserId: 'user2_test', db };
const caller2 = appRouter.createCaller(ctx2);
const project = await caller2.project.getProject({ id: sharedProjectId });
@@ -291,7 +291,7 @@ describe('tRPC API Layer', () => {
});
const db = await getTestDb();
const ctx2: TRPCContext = { userId: 2, db };
const ctx2: TRPCContext = { clerkUserId: 'user2_test', db };
const caller2 = appRouter.createCaller(ctx2);
const projects = await caller2.project.listProjects();