mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-27 02:47:04 -05:00
4.1 KiB
4.1 KiB
Backend Structure Plan
Apps Overview
1. apps.core
- Responsibility: Base classes, shared utilities, history tracking.
- Existing:
SluggedModel,TrackedModel. - Versioning Strategy (Section 15):
- All core entities (
Park,Ride,Company) must utilizedjango-pghistoryorapps.coretracking to support:- Edit History: Chronological list of changes with
reason,user, anddiff. - Timeline: Major events (renames, relocations).
- Rollback: Ability to restore previous versions via the Moderation Queue.
- Edit History: Chronological list of changes with
- All core entities (
2. apps.accounts
- Responsibility: User authentication, profiles, and settings.
- Existing:
User,UserProfile(bio, location, home park). - Required Additions (Section 9):
- UserDeletionRequest: Support 7-day grace period for account deletion.
- Privacy Settings: Fields for
is_profile_public,show_location,show_emailonUserProfile. - Data Export: Serializers/Utilities to dump all user data (Reviews, Credits, Lists) to JSON.
3. apps.parks
- Responsibility: Park management.
- Models:
Park,ParkArea. - Relationships:
operator: FK toapps.companies.Company(Type: Operator).property_owner: FK toapps.companies.Company(Type: Owner).
4. apps.rides
- Responsibility: Ride data, Coasters, and Credits.
- Models:
Ride: Core entity (Status FSM: Operating, SBNO, Closed, etc.).RideModel: Defines the "Type" of ride (e.g., B&M Hyper V2).Manufacturer: FK toapps.companies.Company.Designer: FK toapps.companies.Company.
- Ride Credits (Section 10):
- Model:
RideCredit(Through-Model:User<->Ride). - Fields:
count(Integer): Total times ridden.rating(Float): Personal rating (distinct from public Review).first_ridden_at(Date): First time experiencing the ride.notes(Text): Private personal notes.
- Constraints:
Unique(user, ride)- A user has one credit entry per ride.
- Model:
5. apps.companies
- Responsibility: Management of Industry Entities (Section 4).
- Models:
Company: Single model withtypechoices or Polymorphic.- Types:
Manufacturer,Designer,Operator,PropertyOwner. - Features: Detailed pages, hover cards, listing by type.
6. apps.moderation (The Sacred Submission Pipeline)
- Responsibility: Centralized Content Submission System (Section 14, 16).
- Concept: Live Data (Approve) vs Submission Data (Pending).
- Models:
Submission:submitter: FK to User.content_type: Target Model (Park, Ride, etc.).object_id: Target ID (Null for Creation).data: JSONField storing the proposed state.status: State Machine (Pending->Claimed->Approved|Rejected|ChangesRequested).moderator: FK to User (Claimaint).moderator_note: Reason for rejection/feedback.
Report: User flags on content.
- Workflow:
- User submits form ->
Submissioncreated (Status: Pending). - Moderator Claims -> Status: Claimed.
- Approves -> Applies
datatoLive Model-> Saves Version -> Status: Approved.
- User submits form ->
7. apps.media
- Responsibility: Media Management (Section 13).
- Models:
Photo: GenericFK. Fields:image,caption,user,status(Moderation).- Banner/Card: Entities should link to a "Primary Photo" or store a cached image field.
8. apps.reviews
- Responsibility: Public Reviews & Ratings (Section 12).
- Models:
Review: GenericFK (Park, Ride).- Fields:
rating(1-5, 0.5 steps),title,body,helpful_votes. - Logic: Aggregates (Avg Rating, Count) calculation for Entity caches.
9. apps.lists
- Responsibility: User Lists & Rankings (Section 11).
- Models:
UserList: Title, Description, Type (Park/Ride/Coaster/Mixed), Privacy (Public/Private).UserListItem: FK to List, GenericFK to Item, Order, Notes.
10. apps.blog
- Responsibility: News & Updates.
- Models:
Post,Tag.
11. apps.support
- Responsibility: Human interaction.
- Models:
Ticket(Contact Form).