Files
leocrm/app/schemas/auth.py
T

37 lines
1.0 KiB
Python
Raw Normal View History

"""Auth schemas."""
2026-06-04 00:06:21 +00:00
from __future__ import annotations
from pydantic import BaseModel, EmailStr, Field
class LoginRequest(BaseModel):
email: EmailStr = Field(..., examples=["admin@leocrm.local"])
password: str = Field(..., min_length=1, examples=["secure-password"])
2026-06-04 00:06:21 +00:00
class PasswordResetRequest(BaseModel):
2026-06-04 00:06:21 +00:00
email: EmailStr
class PasswordResetConfirm(BaseModel):
token: str = Field(..., min_length=1)
new_password: str = Field(..., min_length=8)
2026-06-04 00:06:21 +00:00
class SwitchTenantRequest(BaseModel):
tenant_id: str = Field(..., min_length=1)
2026-06-04 00:06:21 +00:00
class AuthResponse(BaseModel):
user_id: str = Field(..., examples=["550e8400-e29b-41d4-a716-446655440000"])
email: str = Field(..., examples=["admin@leocrm.local"])
name: str = Field(..., examples=["Admin User"])
role: str = Field(..., examples=["admin"])
tenant_id: str = Field(..., examples=["550e8400-e29b-41d4-a716-446655440001"])
tenant_name: str | None = Field(None, examples=["Acme GmbH"])
2026-06-04 00:06:21 +00:00
class MessageResponse(BaseModel):
message: str