Files
Neo-ZQYY/apps/backend/app/schemas/auth.py

31 lines
683 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
认证相关 Pydantic 模型。
- LoginRequest登录请求体
- TokenResponse令牌响应体
- RefreshRequest刷新令牌请求体
"""
from pydantic import BaseModel, Field
class LoginRequest(BaseModel):
"""登录请求。"""
username: str = Field(..., min_length=1, max_length=64, description="用户名")
password: str = Field(..., min_length=1, description="密码")
class RefreshRequest(BaseModel):
"""刷新令牌请求。"""
refresh_token: str = Field(..., min_length=1, description="刷新令牌")
class TokenResponse(BaseModel):
"""令牌响应。"""
access_token: str
refresh_token: str
token_type: str = "bearer"