Changes committed
This commit is contained in:
43
docengine/app/schemas/auth.py
Normal file
43
docengine/app/schemas/auth.py
Normal file
@@ -0,0 +1,43 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user