
- Added comprehensive book management with CRUD operations - Implemented inventory tracking with stock management and reservations - Created order management system with status tracking - Integrated Stripe payment processing with payment intents - Added SQLite database with SQLAlchemy ORM and Alembic migrations - Implemented health check and API documentation endpoints - Added comprehensive error handling and validation - Configured CORS middleware for frontend integration
26 lines
726 B
Python
26 lines
726 B
Python
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
class InventoryBase(BaseModel):
|
|
book_id: int
|
|
quantity: int = Field(..., ge=0)
|
|
reserved_quantity: int = Field(default=0, ge=0)
|
|
reorder_level: int = Field(default=10, ge=0)
|
|
|
|
class InventoryCreate(InventoryBase):
|
|
pass
|
|
|
|
class InventoryUpdate(BaseModel):
|
|
quantity: Optional[int] = Field(None, ge=0)
|
|
reserved_quantity: Optional[int] = Field(None, ge=0)
|
|
reorder_level: Optional[int] = Field(None, ge=0)
|
|
|
|
class InventoryResponse(InventoryBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
available_quantity: int
|
|
|
|
class Config:
|
|
from_attributes = True |