Automated Action a28e115e4f Implement simple cart system with FastAPI and SQLite
- Set up project structure with FastAPI and SQLite
- Create models for products and cart items
- Implement schemas for API request/response validation
- Add database migrations with Alembic
- Create service layer for business logic
- Implement API endpoints for cart operations
- Add health endpoint for monitoring
- Update documentation
- Fix linting issues
2025-05-18 23:36:40 +00:00

31 lines
628 B
Python

from typing import Generic, TypeVar, List, Optional
from pydantic import BaseModel
T = TypeVar('T')
class PaginationParams(BaseModel):
"""Schema for pagination parameters."""
skip: int = 0
limit: int = 100
class ResponseBase(BaseModel):
"""Base schema for API responses."""
success: bool
message: str
class DataResponse(ResponseBase, Generic[T]):
"""Schema for API responses with data."""
data: Optional[T] = None
class PaginatedResponse(ResponseBase, Generic[T]):
"""Schema for paginated API responses."""
data: List[T]
total: int
page: int
size: int
pages: int