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

@@ -6,6 +6,7 @@ Common settings shared across all environments.
import environ # type: ignore[import]
import sys
from pathlib import Path
from decouple import config
# Initialize environment variables with better defaults
env = environ.Env(
@@ -37,10 +38,6 @@ apps_dir = BASE_DIR / "apps"
if apps_dir.exists() and str(apps_dir) not in sys.path:
sys.path.insert(0, str(apps_dir))
# Add backend directory to sys.path so Django can find the api module
if str(BASE_DIR) not in sys.path:
sys.path.insert(0, str(BASE_DIR))
# Read environment file if it exists
environ.Env.read_env(BASE_DIR / ".env")
@@ -144,6 +141,15 @@ TEMPLATES = [
WSGI_APPLICATION = "thrillwiki.wsgi.application"
# Cloudflare Images Settings
STORAGES = {"default": {"BACKEND": "cloudflare_images.storage.CloudflareImagesStorage"}}
CLOUDFLARE_IMAGES_ACCOUNT_ID = config('CLOUDFLARE_IMAGES_ACCOUNT_ID')
CLOUDFLARE_IMAGES_API_KEY = config('CLOUDFLARE_IMAGES_API_KEY')
CLOUDFLARE_IMAGES_ACCOUNT_HASH = config('CLOUDFLARE_IMAGES_ACCOUNT_HASH')
CLOUDFLARE_IMAGES_DOMAIN = config(
'CLOUDFLARE_IMAGES_DOMAIN', default='imagedelivery.net')
CLOUDFLARE_EMAIL = config('CLOUDFLARE_EMAIL')
# Password validation
AUTH_PASSWORD_VALIDATORS = [
{
@@ -278,17 +284,14 @@ REST_FRAMEWORK = {
# CORS Settings for API
CORS_ALLOWED_ORIGINS = env("CORS_ALLOWED_ORIGINS", default=[]) # type: ignore[arg-type]
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOW_ALL_ORIGINS = env(
"CORS_ALLOW_ALL_ORIGINS", default=False
) # type: ignore[arg-type]
CORS_ALLOW_ALL_ORIGINS = env("CORS_ALLOW_ALL_ORIGINS",
default=False) # type: ignore[arg-type]
# API-specific settings
API_RATE_LIMIT_PER_MINUTE = env.int(
"API_RATE_LIMIT_PER_MINUTE", default=60
) # type: ignore[arg-type]
"API_RATE_LIMIT_PER_MINUTE", default=60) # type: ignore[arg-type]
API_RATE_LIMIT_PER_HOUR = env.int(
"API_RATE_LIMIT_PER_HOUR", default=1000
) # type: ignore[arg-type]
"API_RATE_LIMIT_PER_HOUR", default=1000) # type: ignore[arg-type]
# drf-spectacular settings
SPECTACULAR_SETTINGS = {