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:
2026-02-25 21:49:26 -05:00
parent 7cd97365f2
commit 84055a25de
267 changed files with 377 additions and 37834 deletions

View File

@ -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
}
};
}