41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.routers import products, categories, suppliers, inventory
|
|
from app.db.session import engine
|
|
from app.db.base import Base
|
|
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
app = FastAPI(
|
|
title="Small Business Inventory System",
|
|
description="A comprehensive inventory management system for small businesses",
|
|
version="1.0.0",
|
|
openapi_url="/openapi.json"
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(products.router, prefix="/products", tags=["products"])
|
|
app.include_router(categories.router, prefix="/categories", tags=["categories"])
|
|
app.include_router(suppliers.router, prefix="/suppliers", tags=["suppliers"])
|
|
app.include_router(inventory.router, prefix="/inventory", tags=["inventory"])
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {
|
|
"title": "Small Business Inventory System",
|
|
"description": "A comprehensive inventory management system for small businesses",
|
|
"version": "1.0.0",
|
|
"documentation": "/docs",
|
|
"health_check": "/health"
|
|
}
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {"status": "healthy", "service": "inventory-system"} |