# Supabase → Django Endpoint Mapping

## Overview
This document maps all Supabase endpoints to their Django REST Framework equivalents.

---

## Edge Function Mappings

### Images
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `upload-image` | `/api/v1/images/generate-upload-url/` | POST | ✅ |
| `delete-image` | `/api/v1/images/delete/` | POST | ✅ |
| `generate-og-image` | `/api/v1/images/og-image/` | POST | ✅ |

### Location/Maps
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `detect-location` | `/api/v1/maps/detect-location/` | POST | ✅ |
| `enrich-location` | `/api/v1/maps/enrich-location/` | POST | ✅ |
| `search-location` | `/api/v1/maps/search-location/` | POST | ✅ |

### Notifications (Django Native)
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `get-notifications` | `/api/v1/notifications/` | GET | ✅ |
| `mark-notification-read` | `/api/v1/notifications/mark-read/` | POST | ✅ |
| `get-unread-count` | `/api/v1/notifications/unread-count/` | GET | ✅ |

### Moderation
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `process-bulk-approval` | `/api/v1/moderation/api/bulk-operations/` | POST | ✅ |
| `claim-submission` | `/api/v1/moderation/api/queue/` | POST | ✅ |
| `convert-submission-to-edit` | `/api/v1/moderation/api/edit-submissions/` | POST | ✅ |

### Auth/MFA
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `mfa-unenroll` | `/api/v1/auth/mfa/totp/deactivate/` | POST | ✅ |
| `process-oauth-profile` | `/api/v1/auth/social/process-profile/` | POST | ✅ |

### Account Management
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `cancel-account-deletion` | `/api/v1/accounts/delete-account/cancel/` | POST | ✅ |
| `confirm-account-deletion` | `/api/v1/accounts/delete-account/verify/` | POST | ✅ |
| `cancel-email-change` | `/api/v1/accounts/email-change/cancel/` | POST | ✅ |
| `export-user-data` | `/api/v1/accounts/data-export/` | POST | ✅ |

### Admin Dashboard
| Supabase Function | Django Endpoint | Method | Status |
|-------------------|-----------------|--------|--------|
| `detect-anomalies` | `/api/v1/admin/anomalies/detect/` | POST | ✅ |
| `collect-metrics` | `/api/v1/admin/metrics/collect/` | POST | ✅ |
| `pipeline-integrity-scan` | `/api/v1/admin/pipeline/integrity-scan/` | POST | ✅ |
| `task-status` | `/api/v1/admin/tasks/status/` | GET | ✅ |

---

## Table Mappings

| Supabase Table | Django Endpoint |
|----------------|-----------------|
| `parks` | `/api/v1/parks/` |
| `rides` | `/api/v1/rides/` |
| `companies` | `/api/v1/companies/` |
| `ride_models` | `/api/v1/rides/models/` |
| `profiles` | `/api/v1/accounts/profiles/` |
| `reviews` | `/api/v1/reviews/` |
| `photos` | `/api/v1/media/photos/` |
| `content_submissions` | `/api/v1/moderation/submissions/` |
| `ride_credits` | `/api/v1/accounts/credits/` |

---

## Scheduled Tasks (Celery)

| Supabase Function | Celery Task |
|-------------------|-------------|
| `process-scheduled-deletions` | `apps.core.tasks.scheduled` |
| `process-closing-entities` | `apps.core.tasks.scheduled` |
| `cleanup-orphaned-images` | `apps.core.tasks.scheduled` |

---

## Deprecated

| Function | Status |
|----------|--------|
| `migrate-novu-users` | 🚫 Replaced by Django native |
| `novu-webhook` | 🚫 Replaced by Django native |
