46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
|
|
# -*- 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"}
|