
- Setup project structure with FastAPI application - Create database models with SQLAlchemy - Configure Alembic for database migrations - Implement CRUD operations for products, categories, suppliers - Add inventory transaction functionality - Implement user authentication with JWT - Add health check endpoint - Create comprehensive documentation
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from app.models.inventory_transaction import TransactionType
|
|
|
|
|
|
# Shared properties
|
|
class InventoryTransactionBase(BaseModel):
|
|
transaction_type: TransactionType
|
|
quantity: int
|
|
unit_price: Optional[float] = None
|
|
transaction_date: Optional[datetime] = None
|
|
notes: Optional[str] = None
|
|
reference_number: Optional[str] = None
|
|
product_id: int
|
|
user_id: Optional[int] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class InventoryTransactionCreate(InventoryTransactionBase):
|
|
pass
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class InventoryTransactionUpdate(InventoryTransactionBase):
|
|
transaction_type: Optional[TransactionType] = None
|
|
quantity: Optional[int] = None
|
|
product_id: Optional[int] = None
|
|
|
|
|
|
class InventoryTransactionInDBBase(InventoryTransactionBase):
|
|
id: int
|
|
user_id: int
|
|
created_at: Optional[datetime] = None
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class InventoryTransaction(InventoryTransactionInDBBase):
|
|
pass |