mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 01:51:12 -05:00
Add ReviewEvent model and ReviewSubmissionService for review management
- Created a new ReviewEvent model to track review events with fields for content, rating, moderation status, and timestamps. - Added ForeignKey relationships to connect ReviewEvent with ContentSubmission, User, and Review. - Implemented ReviewSubmissionService to handle review submissions, including creation, updates, and moderation workflows. - Introduced atomic transactions to ensure data integrity during review submissions and updates. - Added logging for review submission and moderation actions for better traceability. - Implemented validation to prevent duplicate reviews and ensure only the review owner can update their review.
This commit is contained in:
@@ -152,7 +152,6 @@ def generate_entity_report(entity_type, entity_id):
|
||||
from apps.entities.models import Park, Ride, Company, RideModel
|
||||
from apps.media.models import Photo
|
||||
from apps.moderation.models import ContentSubmission
|
||||
from apps.versioning.models import EntityVersion
|
||||
|
||||
try:
|
||||
model_map = {
|
||||
@@ -206,10 +205,8 @@ def generate_entity_report(entity_type, entity_id):
|
||||
status='pending'
|
||||
).count(),
|
||||
},
|
||||
'versions': EntityVersion.objects.filter(
|
||||
content_type__model=entity_type.lower(),
|
||||
object_id=entity_id
|
||||
).count(),
|
||||
# Version history now tracked via pghistory Event models
|
||||
# Can query {ModelName}Event if needed (e.g., ParkEvent, RideEvent)
|
||||
}
|
||||
|
||||
logger.info(f"Generated report for {entity_type} {entity_id}")
|
||||
|
||||
Reference in New Issue
Block a user