diff --git a/app/schema/review_schema.py b/app/schema/review_schema.py index 36b91e9..7d23601 100644 --- a/app/schema/review_schema.py +++ b/app/schema/review_schema.py @@ -1,3 +1,4 @@ +from datetime import datetime from pydantic import BaseModel, Field @@ -10,6 +11,7 @@ class ReviewCreateSchema(BaseModel): class ReviewResponseSchema(ReviewCreateSchema): id: int movie_id: int + created_at: datetime class AverageMovieRating(BaseModel): diff --git a/app/services/reviews_service.py b/app/services/reviews_service.py index c23f462..680134b 100644 --- a/app/services/reviews_service.py +++ b/app/services/reviews_service.py @@ -1,3 +1,4 @@ +from datetime import datetime from fastapi import HTTPException, status from sqlalchemy import desc from app.models.movie_model import Review @@ -35,6 +36,7 @@ def add_new_review( comment=review.comment, rating=review.rating, ip_address=ip_address, + created_at=datetime.now(), ) db.add(new_review) db.commit()