2026-02-02 23:20:32 +09:00
|
|
|
"""
|
|
|
|
|
User schemas for request/response validation.
|
|
|
|
|
"""
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
|
|
|
username: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserCreate(UserBase):
|
2026-05-27 22:51:57 +09:00
|
|
|
"""Input schema — strict EmailStr validation for user-supplied email."""
|
|
|
|
|
email: EmailStr
|
2026-02-02 23:20:32 +09:00
|
|
|
password: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserResponse(UserBase):
|
2026-05-27 22:51:57 +09:00
|
|
|
"""Response schema — email is serialised as-is from DB (no re-validation)."""
|
2026-02-02 23:20:32 +09:00
|
|
|
id: int
|
2026-05-27 22:51:57 +09:00
|
|
|
email: str
|
2026-02-02 23:20:32 +09:00
|
|
|
created_at: datetime
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
from_attributes = True
|