mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 16:51:14 -05:00
feat: Implement API and cache improvements
This commit is contained in:
@@ -171,3 +171,49 @@ When migrating a component:
|
||||
- [ ] Replace loading state with `mutation.isPending`
|
||||
- [ ] Remove try/catch blocks from component
|
||||
- [ ] Test optimistic updates if applicable
|
||||
- [ ] Add audit log creation where appropriate
|
||||
- [ ] Ensure proper type safety with TypeScript
|
||||
|
||||
## Available Mutation Hooks
|
||||
|
||||
### Profile & User Management
|
||||
- `useProfileUpdateMutation` - Profile updates (username, display name, bio)
|
||||
- `useProfileLocationMutation` - Location and personal info updates
|
||||
- `usePrivacyMutations` - Privacy settings updates
|
||||
|
||||
### Security
|
||||
- `useSecurityMutations` - Session management (revoke sessions)
|
||||
|
||||
### Moderation
|
||||
- `useReportMutation` - Submit user reports
|
||||
- `useReportActionMutation` - Resolve/dismiss reports
|
||||
|
||||
### Admin
|
||||
- `useAuditLogs` - Query audit logs with pagination
|
||||
|
||||
## Cache Invalidation Guidelines
|
||||
|
||||
Always invalidate related caches after mutations:
|
||||
|
||||
```typescript
|
||||
// After profile update
|
||||
invalidateUserProfile(userId);
|
||||
invalidateProfileStats(userId);
|
||||
invalidateProfileActivity(userId);
|
||||
invalidateUserSearch(); // If username/display name changed
|
||||
|
||||
// After privacy update
|
||||
invalidateUserProfile(userId);
|
||||
invalidateAuditLogs(userId);
|
||||
invalidateUserSearch(); // If privacy level changed
|
||||
|
||||
// After report action
|
||||
invalidateModerationQueue();
|
||||
invalidateModerationStats();
|
||||
invalidateAuditLogs();
|
||||
|
||||
// After security action
|
||||
invalidateSessions();
|
||||
invalidateAuditLogs();
|
||||
invalidateEmailChangeStatus(); // For email changes
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user