teachers / models.py
JairoDanielMT's picture
Upload 9 files
f5c0d34 verified
raw
history blame
650 Bytes
from pydantic import BaseModel, Field
from datetime import datetime
from typing import Optional
class User(BaseModel):
id: Optional[int] = None
username: str = Field(..., max_length=20)
email: str = Field(..., max_length=120)
password: str = Field(..., max_length=60)
class Teacher(BaseModel):
id: int
name: str = Field(..., max_length=100)
department: str = Field(..., max_length=100)
class Review(BaseModel):
id: Optional[int] = None
content: str
rating: int
date_posted: datetime = Field(default_factory=datetime.now)
teacher_id: int
user_id: Optional[int] = None