File size: 811 Bytes
62a1756 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field, EmailStr
class UserCreate(BaseModel):
username: str = Field(..., min_length=3, max_length=50)
email: EmailStr = Field(..., description="User email (must be unique)")
company: str = Field(default="", max_length=128)
password: str = Field(..., min_length=8, description="User password (will be hashed).")
class UserInDB(BaseModel):
username: str
email: str
company: str
hashed_password: str
created_at: datetime = Field(default_factory=datetime.utcnow)
class UserPublic(BaseModel):
username: str
email: str
company: str
created_at: datetime
class Token(BaseModel):
access_token: str
token_type: str = "bearer"
refresh_token: str
expires_in: int |