refactor: migrate fully to Supabase, remove Firebase/Render/Python backend
- DELETED: entire backend/ (Python/FastAPI — replaced by Supabase)
- DELETED: old/ directory (obsolete code)
- DELETED: render.yaml, inject_api.py, check_tags.py, PENDING_FOR_TOMORROW.md
- DELETED: frontend/src/firebaseConfig.ts (Firebase Auth replaced by Supabase Auth)
- DELETED: frontend/src/services/apiClient.ts (HTTP client for dead backend)
- MIGRATED services to Supabase native:
schedulesService, favoritesService, usersService,
telemetryService (stub), reportsService, analyticsService (stub)
- MIGRATED stores/favorites.ts to Supabase direct queries
- MIGRATED views: SplashScreen, AdminTaxis, AdminDrivers, StrategicAnalytics
- MIGRATED utils/imageUrl.ts to Supabase Storage URLs
- FIXED router/index.ts: guard now uses supabase.auth.getSession()
instead of old localStorage auth_token (fixes logout + map loading)
- FIXED AuthView.vue: removed aggressive watch({ immediate: true })
that caused wrong redirects on map route
- FIXED SplashScreen.vue: navigate() now reads Supabase session + role
- FIXED RLS: added INSERT policy on public.users for trigger
- CONFIRMED: admin@sibu.com assigned ADMIN role in Supabase
This commit is contained in:
@ -1,27 +1,35 @@
|
||||
import { apiClient } from './apiClient';
|
||||
import { supabase } from '@/supabase';
|
||||
|
||||
export const usersService = {
|
||||
async searchUsers(email: string) {
|
||||
const response = await apiClient.get('/api/users/search', {
|
||||
params: { email }
|
||||
});
|
||||
return response.data;
|
||||
const { data, error } = await supabase.from('users').select('*').ilike('email', `%${email}%`)
|
||||
if (error) throw new Error(error.message)
|
||||
return data
|
||||
},
|
||||
|
||||
async getUserDetails(userId: string) {
|
||||
const response = await apiClient.get(`/api/users/${userId}`);
|
||||
return response.data;
|
||||
const { data, error } = await supabase.from('users').select('*').eq('id', userId).single()
|
||||
if (error) throw new Error(error.message)
|
||||
return data
|
||||
},
|
||||
|
||||
async getPendingDrivers() {
|
||||
const response = await apiClient.get('/api/users/pending-drivers');
|
||||
return response.data;
|
||||
const { data, error } = await supabase
|
||||
.from('driver_profiles')
|
||||
.select('*, user:users(*)')
|
||||
.eq('users.is_verified', false)
|
||||
if (error) throw new Error(error.message)
|
||||
return data
|
||||
},
|
||||
|
||||
async verifyUser(userId: string, isVerified: boolean) {
|
||||
const response = await apiClient.post(`/api/users/${userId}/verify`, null, {
|
||||
params: { is_verified: isVerified }
|
||||
});
|
||||
return response.data;
|
||||
const { data, error } = await supabase
|
||||
.from('users')
|
||||
.update({ is_verified: isVerified })
|
||||
.eq('id', userId)
|
||||
.select()
|
||||
.single()
|
||||
if (error) throw new Error(error.message)
|
||||
return data
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user