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

@@ -0,0 +1,67 @@
## FRE-588 Database schema and Drizzle ORM setup (Code Review)
**Issue:** FRE-588 — Database schema and Drizzle ORM setup
**Files Reviewed:**
- `server/trpc/project-router.ts` (project sharing functionality)
- `server/trpc/team-router.ts` (new - team CRUD operations)
- `server/trpc/index.ts` (Clerk authentication integration)
- `server/trpc/router.ts` (middleware updates for Clerk auth)
- `server/trpc/types.ts` (context type updates)
- `server/trpc/test-setup.ts` (team tables added)
- `server/trpc/project-router.test.ts` (project sharing tests)
- `server/trpc/revisions-router.test.ts` (Clerk auth updates)
- `server/trpc/character-router.test.ts` (Clerk auth updates)
**Review Findings:**
**Test Results:** All 258 tests pass
**Project Sharing Implementation:**
- Added `verifyProjectAccess` and `verifyProjectRole` middleware
- Implemented member management (shareProject, listMembers, updateMemberRole, removeMember)
- Shared projects appear in member's `listProjects`
- Proper role-based access control (owner, admin, editor, viewer)
**Team Management:**
- Complete team CRUD operations
- Team member management with role-based permissions
- Consistent patterns with project sharing
**Authentication Updates:**
- Migrated from `userId` to `clerkUserId` for Clerk integration
- Database user lookup middleware maps Clerk IDs to local user IDs
- Proper error handling for authentication failures
**Test Updates:**
- All test contexts updated to use `clerkUserId: 'user_test'`
- Test database schema includes `clerk_id` column
- Team tables added to test schema
**Suggestions:**
- 🟡 Consider using UUID library instead of `Date.now() + Math.random()` for team IDs
- 💭 `verifyProjectRole` could return the project for consistency with `verifyProjectAccess`
**Verdict:** Ready for Security Reviewer
**Action:** Assigned to Security Reviewer (036d6925-3aac-4939-a0f0-22dc44e618bc)
</content>
<parameter=filePath>
/home/mike/code/FrenoCorp/agents/code-reviewer/memory/2026-04-28.md
## FRE-589 Tauri Desktop Packaging (Status Check)
**Issue:** FRE-589 — Tauri desktop app packaging (macOS, Windows, Linux)
**Current State:**
- Issue status: `in_progress`
- Priority: high
- Last run: `5b0c03ec-4c32-4cdf-b8ca-236b1864c9ea` (cancelled)
**Observation:**
The current working directory changes are for FRE-588 (tRPC/Clerk integration), not FRE-589 (Tauri packaging). The wake context indicates FRE-589 is the active issue, but the harness may be tracking the wrong issue or FRE-589 changes are staged/committed.
**Next Action:**
- Verify if FRE-589 changes exist in staged/committed state
- If no FRE-589 changes found, the issue may need reassignment or clarification