Files
aza/AzA march 2026/workforce_planner/api/app.py
2026-03-25 22:03:39 +01:00

46 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""
FastAPI Hauptanwendung startet den API-Server.
uvicorn workforce_planner.api.app:app --reload
"""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from ..database import init_db
from .routes_auth import router as auth_router
from .routes_employees import router as emp_router
from .routes_absences import router as abs_router, balance_router
from .routes_ai import router as ai_router
app = FastAPI(
title="Workforce Planner API",
description="Abwesenheits- & Arbeitsplanung Backend für Desktop + Web",
version="0.1.0",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(auth_router, prefix="/api/v1")
app.include_router(emp_router, prefix="/api/v1")
app.include_router(abs_router, prefix="/api/v1")
app.include_router(balance_router, prefix="/api/v1")
app.include_router(ai_router, prefix="/api/v1")
@app.on_event("startup")
def _startup():
init_db()
@app.get("/api/v1/health")
def health():
return {"status": "ok", "service": "workforce_planner"}