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,32 +1,14 @@
import { apiClient } from './apiClient'
export interface TelemetryData {
latitude: number
longitude: number
speed?: number
heading?: number
status?: 'active' | 'offline' | 'break'
}
export interface ActiveUnit {
user_id: string
full_name: string
latitude: number
longitude: number
speed?: number
heading?: number
timestamp: string
vehicle_type: string
license_plate: string
}
import { supabase } from '@/supabase';
/** telemetryService — Previously sent GPS data to the Python backend.
* Now it's a no-op stub since we don't have a custom backend.
* Realtime GPS tracking can be implemented via Supabase Realtime in the future. */
export const telemetryService = {
async sendTelemetry(data: TelemetryData) {
return await apiClient.post('/api/telemetry', data)
async sendLocation(_data: any) {
// No-op: telemetry via Supabase Realtime can be implemented in v3
return null
},
async getActiveUnits(): Promise<ActiveUnit[]> {
const response = await apiClient.get<ActiveUnit[]>('/api/telemetry/active')
return response.data
async getDriverLocation(_driverId: string) {
return null
}
}