mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 10:31:09 -05:00
- Add complete backend/ directory with full Django application - Add frontend/ directory with Vite + TypeScript setup ready for Next.js - Add comprehensive shared/ directory with: - Complete documentation and memory-bank archives - Media files and avatars (letters, park/ride images) - Deployment scripts and automation tools - Shared types and utilities - Add architecture/ directory with migration guides - Configure pnpm workspace for monorepo development - Update .gitignore to exclude .django_tailwind_cli/ build artifacts - Preserve all historical documentation in shared/docs/memory-bank/ - Set up proper structure for full-stack development with shared resources
73 lines
2.1 KiB
Markdown
73 lines
2.1 KiB
Markdown
# Consolidation Analysis
|
|
|
|
## Review System Implementation
|
|
|
|
### Current Implementation
|
|
- Uses Django's GenericForeignKey (confirmed)
|
|
- Single Review model handles both parks and rides
|
|
- Related models: ReviewImage, ReviewLike, ReviewReport
|
|
- Content types: Currently supports any model type
|
|
|
|
### Migration Plan
|
|
|
|
1. **Create New Models**:
|
|
```python
|
|
# parks/models/reviews.py
|
|
class ParkReview(TrackedModel):
|
|
park = models.ForeignKey(Park, on_delete=models.CASCADE)
|
|
# ... other review fields ...
|
|
|
|
# rides/models/reviews.py
|
|
class RideReview(TrackedModel):
|
|
ride = models.ForeignKey(Ride, on_delete=models.CASCADE)
|
|
# ... other review fields ...
|
|
```
|
|
|
|
2. **Data Migration Steps**:
|
|
```python
|
|
# Migration operations
|
|
def migrate_reviews(apps, schema_editor):
|
|
Review = apps.get_model('reviews', 'Review')
|
|
ParkReview = apps.get_model('parks', 'ParkReview')
|
|
RideReview = apps.get_model('rides', 'RideReview')
|
|
|
|
for review in Review.objects.all():
|
|
if review.content_type.model == 'park':
|
|
ParkReview.objects.create(
|
|
park_id=review.object_id,
|
|
# ... map other fields ...
|
|
)
|
|
elif review.content_type.model == 'ride':
|
|
RideReview.objects.create(
|
|
ride_id=review.object_id,
|
|
# ... map other fields ...
|
|
)
|
|
```
|
|
|
|
3. **Update Related Models**:
|
|
```python
|
|
# Before (generic)
|
|
class ReviewImage(models.Model):
|
|
review = models.ForeignKey(Review, ...)
|
|
|
|
# After (concrete)
|
|
class ParkReviewImage(models.Model):
|
|
review = models.ForeignKey(ParkReview, ...)
|
|
|
|
class RideReviewImage(models.Model):
|
|
review = models.ForeignKey(RideReview, ...)
|
|
```
|
|
|
|
4. **Backward Compatibility**:
|
|
- Maintain old Review API during transition period
|
|
- Phase out generic reviews after data migration
|
|
|
|
### Entity Relationship Compliance
|
|
- Park reviews will reference Park model (via Operator)
|
|
- Ride reviews will reference Ride model (via Park → Operator)
|
|
- Complies with entity relationship rules in .clinerules
|
|
|
|
### Risk Mitigation
|
|
- Use data migration transactions
|
|
- Create database backups before migration
|
|
- Test with staging data first |