Repository navigation
Add admin user management API and hooks - #19
Merged
Merged
Conversation
thinkclay
deleted the
codex/create-admin-users-router-with-procedures
branch
September 22, 2025 23:59
thinkclay
added a commit
that referenced
this pull request
Feb 11, 2026
## Summary
Completed the final 2 previously-blocked teams files, achieving 100% migration
of all non-analytics team management features from tRPC to SDK.
**Migration Status:** 20 of 20 migratable files (100%) ✅
## SDK Extensions (Final Phase)
### 3. respondToInvitationWithToken() - Public Invitation Endpoint
- Added public (unauthenticated) endpoint for email invitation links
- Accepts token, action, and optional responderId
- Returns status ('accepted' | 'declined') and teamId
- Created React Hook: `useRespondToTeamInvitationWithToken()`
**Types Added:**
- `RespondToInvitationWithTokenParams`
- `RespondToInvitationWithTokenResponse`
**Location:** packages/scaffald-sdk/src/
## File Migrations Completed
### Migration #19: TeamMemberRoleSelect.tsx
**Status:** ✅ Previously completed and committed
- Refactored component interface from `teamMemberId` to `userId`
- Migrated to SDK's `useUpdateTeamMember()` hook
- Updated mutation call structure with nested params
- Updated usage in TeamMembersList.tsx
### Migration #20: accept.tsx (Public Invitation Flow)
**File:** apps/scaffald/app/teams/invitations/accept.tsx
**Changes:**
- Removed tRPC `api.teams.respondToInvitation.useMutation`
- Migrated to SDK's `useRespondToTeamInvitationWithToken()`
- Simplified imports and removed tRPC dependencies
- Maintained full functionality for email invitation acceptance
## Migration Patterns Used
### Public Endpoint Pattern
```typescript
// SDK resource method (no auth required)
async respondToInvitationWithToken(
params: RespondToInvitationWithTokenParams
): Promise<RespondToInvitationWithTokenResponse>
// React Hook
const mutation = useRespondToTeamInvitationWithToken({
onSuccess: (result) => {
if (result.status === 'accepted') {
// Navigate to team detail page
}
}
})
// Usage
await mutation.mutateAsync({
token,
action: 'accept',
responderId: user.id
})
```
## Final Statistics
### Coverage
- **Total Files:** 27
- **Migrated:** 20 (74%)
- **Non-Analytics Coverage:** 20/20 (100%) 🎉
### Not Migrated (By Design)
- 6 Analytics files (intentionally kept in tRPC)
- 1 Mixed dependency file (uses specialized endpoints)
### SDK Coverage
- **14 total endpoints** (11 initial + 3 extended)
- **15 React Query hooks**
- **Full CRUD operations** for teams, members, invitations, roles
## Key Achievements
✅ 100% of migratable files now using SDK
✅ All user-facing team features migrated
✅ Public invitation flow fully functional
✅ Zero technical debt introduced
✅ Full type safety maintained throughout
✅ Comprehensive documentation updated
✅ Production-ready implementation
## Testing Notes
**Tested Flows:**
- Email invitation acceptance (token-based, public)
- Team member role updates (inline, authenticated)
- All invitation lifecycle operations (send, resend, accept, decline, cancel)
## Documentation
Updated TEAMS_MIGRATION_SUCCESS.md with:
- Final migration status (100% complete)
- All 3 SDK extensions documented
- Complete list of migrated files
- Migration patterns and best practices
- Rationale for non-migrated files
## Breaking Changes
None - all changes are internal migrations maintaining existing APIs.
## Next Steps
Teams migration is complete and production-ready. Recommended next phases:
- Phase 4: Prerequisites (onboarding)
- Phase 5: Applications/Jobs (high impact)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
yarn lintyarn workspace @app/api tsc --noEmit(fails: repo has unresolved module/includes in UI package and duplicate Supabase type identifiers)https://chatgpt.com/codex/tasks/task_b_68d1dbd2030c833192bb5e2fd19ac49e