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,28 +1,17 @@
|
||||
import { apiClient } from './apiClient';
|
||||
|
||||
export interface Report {
|
||||
id: string;
|
||||
user_id?: string;
|
||||
user_name?: string;
|
||||
message: string;
|
||||
status: 'pending' | 'resolved' | 'archived';
|
||||
created_at: string;
|
||||
}
|
||||
/** reportsService — Previously called the Python backend for report generation.
|
||||
* Reports are now generated directly from Supabase queries in the AdminReports view. */
|
||||
import { supabase } from '@/supabase';
|
||||
|
||||
export const reportsService = {
|
||||
async sendReport(message: string) {
|
||||
const response = await apiClient.post('/api/reports', { message });
|
||||
return response.data;
|
||||
async getRoutesReport() {
|
||||
const { data, error } = await supabase.from('routes').select('*')
|
||||
if (error) throw new Error(error.message)
|
||||
return data
|
||||
},
|
||||
|
||||
async getReports() {
|
||||
// This would be for the admin
|
||||
const response = await apiClient.get('/api/reports');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async updateReportStatus(reportId: string, status: string) {
|
||||
const response = await apiClient.patch(`/api/reports/${reportId}`, { status });
|
||||
return response.data;
|
||||
async getUsersReport() {
|
||||
const { data, error } = await supabase.from('users').select('id, email, role, created_at, is_active')
|
||||
if (error) throw new Error(error.message)
|
||||
return data
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user