22 lines
708 B
Python
22 lines
708 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ScoreBase(BaseModel):
|
|
user_id: str = Field(
|
|
description="UUID representation of the user",
|
|
examples=["123e4567-e89b-12d3-a456-426655440000"],
|
|
)
|
|
movie_id: str = Field(
|
|
description="UUID representation of the movie",
|
|
examples=["123e4567-e89b-12d3-a456-426655440000"],
|
|
)
|
|
score: int = Field(description="Score of the movie", examples=[5], ge=-18, le=33)
|
|
created_at: Optional[datetime] = Field(default_factory=datetime.utcnow)
|
|
updated_at: Optional[datetime] = Field(default_factory=datetime.utcnow)
|
|
|
|
|
|
class ScoreDB(ScoreBase):
|
|
id: Optional[str]
|