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:
pacnpal
2025-11-08 16:49:58 -05:00
parent 618310a87b
commit 9122320e7e
18 changed files with 3170 additions and 171 deletions

View File

@@ -12,6 +12,7 @@ from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.utils.text import slugify
from django_lifecycle import hook, AFTER_CREATE, AFTER_UPDATE, BEFORE_SAVE
import pghistory
from apps.core.models import VersionedModel, BaseModel
@@ -27,6 +28,7 @@ if _using_postgis:
from django.contrib.postgres.search import SearchVectorField
@pghistory.track()
class Company(VersionedModel):
"""
Represents a company in the amusement industry.
@@ -194,6 +196,7 @@ class Company(VersionedModel):
return photos
@pghistory.track()
class RideModel(VersionedModel):
"""
Represents a specific ride model from a manufacturer.
@@ -328,6 +331,7 @@ class RideModel(VersionedModel):
return photos
@pghistory.track()
class Park(VersionedModel):
"""
Represents an amusement park, theme park, water park, or FEC.
@@ -638,6 +642,7 @@ if _using_postgis:
)
@pghistory.track()
class Ride(VersionedModel):
"""
Represents an individual ride or roller coaster.