Add migrations for ParkPhoto and RidePhoto models with associated events

- Created ParkPhoto and ParkPhotoEvent models in the parks app, including fields for image, caption, alt text, and relationships to the Park model.
- Implemented triggers for insert and update operations on ParkPhoto to log changes in ParkPhotoEvent.
- Created RidePhoto and RidePhotoEvent models in the rides app, with similar structure and functionality as ParkPhoto.
- Added fields for photo type in RidePhoto and implemented corresponding triggers for logging changes.
- Established necessary indexes and unique constraints for both models to ensure data integrity and optimize queries.
This commit is contained in:
pacnpal
2025-08-26 14:40:46 -04:00
parent 831be6a2ee
commit e4e36c7899
133 changed files with 1321 additions and 1001 deletions

View File

@@ -39,15 +39,15 @@ backend/
### Required URL Pattern
- **Frontend requests:** `/api/{endpoint}`
- **Vite proxy rewrites to:** `/api/v1/{endpoint}`
- **Django serves from:** `backend/api/v1/{endpoint}`
- **Django serves from:** `backend/apps/api/v1/{endpoint}`
### Migration Requirements
When consolidating rogue API endpoints:
1. **BEFORE REMOVAL:** Ensure ALL functionality exists in `backend/api/v1/`
2. **Move views:** Transfer all API views to appropriate `backend/api/v1/{domain}/views.py`
3. **Move serializers:** Transfer to `backend/api/v1/{domain}/serializers.py`
4. **Update URLs:** Consolidate routes in `backend/api/v1/{domain}/urls.py`
1. **BEFORE REMOVAL:** Ensure ALL functionality exists in `backend/apps/api/v1/`
2. **Move views:** Transfer all API views to appropriate `backend/apps/api/v1/{domain}/views.py`
3. **Move serializers:** Transfer to `backend/apps/api/v1/{domain}/serializers.py`
4. **Update URLs:** Consolidate routes in `backend/apps/api/v1/{domain}/urls.py`
5. **Test thoroughly:** Verify all endpoints work via central API
6. **Only then remove:** Delete the rogue `api_urls.py` and `api_views.py` files
@@ -61,8 +61,8 @@ If rogue API files are discovered:
5. **Remove rogue files only after verification**
### URL Routing Rules
- **Main API router:** `backend/api/urls.py` includes `api/v1/urls.py`
- **Version router:** `backend/api/v1/urls.py` includes domain-specific routes
- **Main API router:** `backend/apps/api/urls.py` includes `apps/api/v1/urls.py`
- **Version router:** `backend/apps/api/v1/urls.py` includes domain-specific routes
- **Domain routers:** `backend/api/v1/{domain}/urls.py` defines actual endpoints
- **No direct app routing:** Apps CANNOT define their own API URLs
@@ -72,21 +72,21 @@ If rogue API files are discovered:
- **URL consistency:** All frontend API calls follow this pattern
### Quality Assurance
- **No API endpoints** may exist outside `backend/api/v1/`
- **No API endpoints** may exist outside `backend/apps/api/v1/`
- **All API responses** must use proper DRF serializers
- **Consistent error handling** across all endpoints
- **Proper authentication** and permissions on all routes
### Examples of Proper Structure
```python
# backend/api/urls.py
# backend/apps/api/urls.py
from django.urls import path, include
urlpatterns = [
path('v1/', include('api.v1.urls')),
]
# backend/api/v1/urls.py
# backend/apps/api/v1/urls.py
from django.urls import path, include
urlpatterns = [
@@ -95,7 +95,7 @@ urlpatterns = [
path('auth/', include('api.v1.auth.urls')),
]
# backend/api/v1/rides/urls.py
# backend/apps/api/v1/rides/urls.py
from django.urls import path
from . import views