44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
from pydantic import BaseModel, EmailStr, Field
|
|
|
|
from app.schemas.common import BaseSchema
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
"""Login credentials."""
|
|
|
|
username: str = Field(..., min_length=3, max_length=150)
|
|
password: str = Field(..., min_length=8, max_length=128)
|
|
|
|
|
|
class RegisterRequest(BaseModel):
|
|
"""User registration payload."""
|
|
|
|
username: str = Field(..., min_length=3, max_length=150)
|
|
email: EmailStr
|
|
password: str = Field(..., min_length=8, max_length=128)
|
|
full_name: str | None = Field(None, max_length=255)
|
|
|
|
|
|
class TokenResponse(BaseSchema):
|
|
"""JWT token pair response."""
|
|
|
|
access_token: str
|
|
refresh_token: str
|
|
token_type: str = "bearer"
|
|
expires_in: int
|
|
|
|
|
|
class RefreshTokenRequest(BaseModel):
|
|
"""Refresh token request payload."""
|
|
|
|
refresh_token: str
|
|
|
|
|
|
class ChangePasswordRequest(BaseModel):
|
|
"""Change password payload."""
|
|
|
|
current_password: str = Field(..., min_length=8, max_length=128)
|
|
new_password: str = Field(..., min_length=8, max_length=128)
|