feat(api): Pydantic schemas + Data Repositories
This commit is contained in:
42
app/schemas/auth.py
Normal file
42
app/schemas/auth.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Authentication schemas."""
|
||||
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
|
||||
|
||||
class RegisterRequest(BaseModel):
|
||||
"""Request body for user registration."""
|
||||
|
||||
email: EmailStr
|
||||
password: str = Field(min_length=8, max_length=128)
|
||||
org_name: str = Field(min_length=1, max_length=100, description="Name for the default org")
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
"""Request body for user login."""
|
||||
|
||||
email: EmailStr
|
||||
password: str
|
||||
|
||||
|
||||
class RefreshRequest(BaseModel):
|
||||
"""Request body for token refresh."""
|
||||
|
||||
refresh_token: str
|
||||
|
||||
|
||||
class SwitchOrgRequest(BaseModel):
|
||||
"""Request body for switching active organization."""
|
||||
|
||||
org_id: UUID
|
||||
refresh_token: str
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
"""Response containing access and refresh tokens."""
|
||||
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str = "bearer"
|
||||
expires_in: int = Field(description="Access token expiry in seconds")
|
||||
Reference in New Issue
Block a user