43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api.routes import clientes, subclientes, timbres, auth, ui
|
|
|
|
# NO crear tablas automáticamente - usar Alembic para migraciones
|
|
# Base.metadata.create_all(bind=engine)
|
|
|
|
app = FastAPI(
|
|
title="Control MVE API",
|
|
description="API para llevar control de timbres o firmas por cliente",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# Configurar CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Incluir routers
|
|
app.include_router(auth.router, prefix="/api/v1/auth", tags=["Autenticación"])
|
|
app.include_router(clientes.router, prefix="/api/v1/clientes", tags=["Clientes"])
|
|
app.include_router(subclientes.router, prefix="/api/v1/subclientes", tags=["SubClientes"])
|
|
app.include_router(timbres.router, prefix="/api/v1/timbres", tags=["Timbres"])
|
|
app.include_router(ui.router, prefix="/api/v1/ui", tags=["Datos UI"])
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {
|
|
"message": "Control MVE API",
|
|
"version": "1.0.0",
|
|
"docs": "/docs"
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "healthy"}
|