# PHASE 10: Users & Profiles **Status:** ⬜ Not Started **Estimated Time:** 8-10 hours **Priority:** HIGH **Depends On:** Phase 1 (Foundation), Phase 2 (Authentication) **Blocks:** Phase 12 (Pages Migration) --- ## 🎯 Goal Migrate all user profile and user management functionality from Supabase to Django. --- ## 📋 Tasks ### Task 10.1: Users Service (3 hours) ```typescript class UsersService extends BaseService { // GET /users/{id}/ async getUser(userId: string): Promise // GET /users/{id}/profile/ async getUserProfile(userId: string): Promise // PATCH /users/{id}/profile/ async updateUserProfile(userId: string, data: Partial): Promise // GET /users/search/?q={query} async searchUsers(query: string): Promise // POST /users/{id}/block/ async blockUser(userId: string): Promise // DELETE /users/{id}/block/ async unblockUser(userId: string): Promise // GET /users/{id}/blocked/ async getBlockedUsers(userId: string): Promise } ``` - [ ] Create `src/services/users/usersService.ts` - [ ] Create types and mappers - [ ] Handle profile updates - [ ] Handle user blocking ### Task 10.2: Update Profile Pages (3 hours) **Files:** - `src/pages/Profile.tsx` - `src/components/profile/UserReviewsList.tsx` - `src/components/profile/RideCreditsManager.tsx` - `src/components/profile/UserBlockButton.tsx` - [ ] Replace `supabase.from('profiles')` with `usersService` - [ ] Replace `supabase.rpc('get_filtered_profile')` - [ ] Update profile editing - [ ] Test profile display ### Task 10.3: Update Settings Pages (3 hours) **Files:** - `src/pages/Settings.tsx` - `src/components/settings/AccountProfileTab.tsx` - `src/components/settings/SecurityTab.tsx` - `src/components/settings/PrivacyTab.tsx` - `src/components/settings/LocationTab.tsx` - `src/components/settings/DataExportTab.tsx` - [ ] Replace all Supabase auth/profile calls - [ ] Update email change flow - [ ] Update password change flow - [ ] Update account deletion flow - [ ] Update data export ### Task 10.4: Update User Blocking (1-2 hours) **Files:** - `src/components/privacy/BlockedUsers.tsx` - `src/components/profile/UserBlockButton.tsx` - [ ] Replace block/unblock operations - [ ] Update blocked users list - [ ] Test blocking functionality --- ## 🎯 Success Criteria - [ ] User profiles display correctly - [ ] Profile editing works - [ ] Settings pages work - [ ] User blocking works - [ ] Avatar uploads work - [ ] Email change works - [ ] Password change works - [ ] Data export works - [ ] Account deletion works - [ ] Zero `supabase.from('profiles')` calls - [ ] Zero `supabase.auth.updateUser()` calls (except in auth service) --- ## ⏭️ Next Phase **Phase 11:** Contact & Reports