Skip to content

Commit

Permalink
add created_at to response schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kenmoh committed Dec 18, 2023
1 parent 947aaaa commit 16a50c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/schema/review_schema.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
from pydantic import BaseModel, Field


Expand All @@ -10,6 +11,7 @@ class ReviewCreateSchema(BaseModel):
class ReviewResponseSchema(ReviewCreateSchema):
id: int
movie_id: int
created_at: datetime


class AverageMovieRating(BaseModel):
Expand Down
2 changes: 2 additions & 0 deletions app/services/reviews_service.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
from fastapi import HTTPException, status
from sqlalchemy import desc
from app.models.movie_model import Review
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 16a50c8

Please sign in to comment.