1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

чиним билд9

This commit is contained in:
MoonTestUse1
2025-01-02 00:22:32 +06:00
parent 35306ad6d2
commit 379cf83d36
4 changed files with 21 additions and 43 deletions

View File

@@ -1,27 +1,11 @@
"""Main application module"""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi.openapi.utils import get_openapi
import logging
from logging.config import dictConfig
from .logging_config import logging_config
from .middleware import LoggingMiddleware
from .routers import auth, employees, requests, admin
# Configure logging
dictConfig(logging_config)
logger = logging.getLogger(__name__)
app = FastAPI()
app = FastAPI(
title="Support Portal API",
description="API for managing support requests and employees",
version="1.0.0",
docs_url=None,
redoc_url=None
)
# Add CORS middleware
# Configure CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
@@ -30,28 +14,8 @@ app.add_middleware(
allow_headers=["*"],
)
# Add logging middleware
app.add_middleware(LoggingMiddleware)
# Include routers
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
app.include_router(employees.router, prefix="/api/employees", tags=["employees"])
app.include_router(requests.router, prefix="/api/requests", tags=["requests"])
app.include_router(admin.router, prefix="/api/admin", tags=["admin"])
# Custom OpenAPI documentation
@app.get("/api/docs", include_in_schema=False)
async def custom_swagger_ui_html():
return get_swagger_ui_html(
openapi_url="/api/openapi.json",
title="Support Portal API Documentation"
)
@app.get("/api/openapi.json", include_in_schema=False)
async def get_open_api_endpoint():
return get_openapi(
title="Support Portal API",
version="1.0.0",
description="API for managing support requests and employees",
routes=app.routes
)
app.include_router(employees.router, prefix="/api", tags=["employees"])
app.include_router(requests.router, prefix="/api", tags=["requests"])
app.include_router(admin.router, prefix="/api/admin", tags=["admin"])