This commit introduces several new analysis documents, including Auto-Match Load Performance Analysis, Folder Picker Analysis, Monorepo Migration Summary, and various performance analysis documents. Additionally, the installation scripts are updated to reflect changes in backend service paths, ensuring proper integration with the new backend structure. These enhancements provide better documentation and streamline the setup process for users.
66 lines
1.3 KiB
Python
66 lines
1.3 KiB
Python
"""Authentication schemas for web API."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Dict
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from backend.constants.roles import DEFAULT_USER_ROLE, UserRole
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
"""Login request payload."""
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
username: str
|
|
password: str
|
|
|
|
|
|
class RefreshRequest(BaseModel):
|
|
"""Refresh token request payload."""
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
refresh_token: str
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
"""Token response payload."""
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
access_token: str
|
|
refresh_token: str
|
|
password_change_required: bool = False
|
|
|
|
|
|
class UserResponse(BaseModel):
|
|
"""User response payload."""
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
username: str
|
|
is_admin: bool = False
|
|
role: UserRole = DEFAULT_USER_ROLE
|
|
permissions: Dict[str, bool] = {}
|
|
|
|
|
|
class PasswordChangeRequest(BaseModel):
|
|
"""Password change request payload."""
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
current_password: str
|
|
new_password: str
|
|
|
|
|
|
class PasswordChangeResponse(BaseModel):
|
|
"""Password change response payload."""
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
success: bool
|
|
message: str
|