- Introduced `lint` and `lint-fix` applications in `flake.nix` for unified linting of backend (Python) and frontend (TypeScript/Svelte) code. - Added `scripts/lint.sh` for manual linting execution. - Created `scripts/install-hooks.sh` to set up git hooks for automatic linting before commits and optional tests before pushes. - Updated `README.md` with instructions for using the new linting features and git hooks.
45 lines
805 B
Python
45 lines
805 B
Python
"""Authentication schemas for request/response validation."""
|
|
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, EmailStr, Field
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
"""Base user schema."""
|
|
|
|
email: EmailStr
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
"""Schema for user registration."""
|
|
|
|
password: str = Field(..., min_length=8, max_length=100)
|
|
|
|
|
|
class UserLogin(BaseModel):
|
|
"""Schema for user login."""
|
|
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
class UserResponse(UserBase):
|
|
"""Schema for user response."""
|
|
|
|
id: UUID
|
|
created_at: datetime
|
|
is_active: bool
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
"""Schema for JWT token response."""
|
|
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
user: UserResponse
|