mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""Main application module."""
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.core.config import settings
|
|
from app.api.endpoints import admin, employees, requests, auth, statistics, chat
|
|
|
|
app = FastAPI(
|
|
title=settings.PROJECT_NAME,
|
|
version=settings.VERSION,
|
|
openapi_url=f"{settings.API_V1_STR}/openapi.json"
|
|
)
|
|
|
|
# Настройка CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Подключаем роутеры
|
|
app.include_router(auth.router, prefix=f"{settings.API_V1_STR}/auth", tags=["auth"])
|
|
app.include_router(admin.router, prefix=f"{settings.API_V1_STR}/admin", tags=["admin"])
|
|
app.include_router(employees.router, prefix=f"{settings.API_V1_STR}/employees", tags=["employees"])
|
|
app.include_router(requests.router, prefix=f"{settings.API_V1_STR}/requests", tags=["requests"])
|
|
app.include_router(statistics.router, prefix=f"{settings.API_V1_STR}/statistics", tags=["statistics"])
|
|
app.include_router(chat.router, prefix=f"{settings.API_V1_STR}/chat", tags=["chat"])
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
"""Root endpoint."""
|
|
return {
|
|
"message": "Welcome to Support System API",
|
|
"version": settings.VERSION,
|
|
"docs_url": "/docs"
|
|
} |