# ThrillWiki Implementation Plan ## User Review Required > [!IMPORTANT] > **Measurement Unit System**: The backend will store all values in **Metric**. The Frontend (Nuxt Composables) will handle conversion to Imperial based on user preference. > **Moderation Workflow**: A State Machine (Pending -> Claimed -> Approved) will be enforced for all user submissions. ## Proposed Changes ### Backend (Django + DRF) #### App Structure & Models - [x] **`apps/core`**: Base models (`SluggedModel`, `TimeStampedModel`), History (`pghistory`, `SlugHistory`), Utilities. - [x] **`apps/accounts`**: `User`, `UserProfile` (bio, location, visual prefs), `Auth` (MFA, Magic Link). - [x] **`apps/parks`**: `Park` (name, location, dates, status, owner/operator FKs). - [x] **`apps/rides`**: - `Ride` (name, park FK, model FK, specs: height/speed/etc stored in metric). - `Manufacturer`, `Designer`, `RideModel` (Company models). - `RideCredit` (M2M: User <-> Ride). **Attributes**: `count`, `first_ridden_at`, `notes`, `ranking`. - [ ] **`apps/reviews`**: `Review` (User, Entity GenericFK, rating 1-5, text, helpful votes). - [ ] **`apps/media`**: `Photo` (image, user, caption, entity GenericFK), `Video`. - [x] **`apps/lists`**: `UserList` (Custom rankings/lists). - [x] **`apps/moderation`**: `Submission` (User, ContentType, Object ID, Changes JSON, Status: Pending/Claimed/Approved/Rejected, Moderator FK), `Report`. - [ ] **`apps/blog`**: `Post`, `Tag`. - [ ] **`apps/support`**: `Ticket` (Contact form). #### API & Logic - **DRF ViewSets**: Full CRUD for all entities (read-only for public, authenticated for mutations). - **Moderation Middleware/Signals**: Intercept mutations to create `Submission` records instead of direct saves for non-staff. - **Versioning**: `pghistory` and `SlugHistory` are already partially implemented in `core`. - **Search**: Global search endpoint. - **Geolocation**: `PostGIS` integrations (already partially in `parks.location_utils`). ### Frontend (Nuxt 4) #### Architecture - **Directory Structure**: - `app/pages/`: File-based routing (e.g., `parks/[slug].vue`). - `app/components/`: Reusable UI components (Design System). - `app/composables/`: Logic reuse (`useUnits`, `useAuth`, `useApi`). - `app/stores/`: Pinia stores (`userStore`, `toastStore`). - `app/layouts/`: `default.vue`, `auth.vue`. - **Tech Stack**: Nuxt 4, Nuxt UI (Tailwind based), Pinia, VueUse. #### Key Features & Composables - **`useUnits`**: Reactively converts metric props to imperial if user pref is set. - **`useAuth`**: Handles JWT/Session, MFA state, User fetching. - **`useModeration`**: For moderators to claim/approve actions. - **Forms**: `Zod` schema validation matching DRF serializers. #### Design System - **Theme**: Dark/Light mode support (built-in to Nuxt UI). - **Components**: - `EntityCard` (Park/Ride summary). - `StandardLayout` (Hero, Tabs, Content). - `MediaGallery`. - `ReviewList`. ## Verification Plan ### Automated Tests - **Backend**: `pytest` for Model constraints, API endpoints, and Moderation flow. - **Frontend**: `vitest` for Unit/Composable tests. E2E tests for critical flows (Submission -> Moderation -> Publish). ### Manual Verification 1. **Ride Credits**: User adds a ride, verifies count increments. 2. **Moderation**: User submits data -> Mod claims -> Mod approves -> Public data updates. 3. **Units**: Toggle preference, verify stats update (e.g., km/h -> mph).