feat: Introduce lists and reviews apps, refactor user list functionality from accounts, and add user profile fields.

This commit is contained in:
pacnpal
2025-12-26 09:27:44 -05:00
parent ed04b30469
commit cd8868a591
37 changed files with 5900 additions and 281 deletions

68
IMPLEMENTATION_PLAN.md Normal file
View File

@@ -0,0 +1,68 @@
# 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).