master-floor/ressult/app/main.py
2025-11-26 19:31:33 +03:00

48 lines
1.8 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.

# app/main.py
"""
Главный модуль FastAPI приложения
Соответствует требованиям ТЗ по интеграции модулей
"""
import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from dotenv import load_dotenv
from app.routes import partners, sales, upload, calculations, auth, config
load_dotenv()
app = FastAPI(
title="MasterPol Partner Management System",
description="REST API для системы управления партнерами согласно ТЗ демонстрационного экзамена",
version="1.0.0"
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Регистрация маршрутов согласно модулям ТЗ
app.include_router(partners.router, prefix="/api/v1/partners", tags=["Partners Management"])
app.include_router(sales.router, prefix="/api/v1/sales", tags=["Sales History"])
app.include_router(upload.router, prefix="/api/v1/upload", tags=["Data Import"])
app.include_router(calculations.router, prefix="/api/v1/calculations", tags=["Calculations"])
app.include_router(config.router, prefix="/api/v1/config", tags=["Configuration"])
app.include_router(auth.router, prefix="/api/v1/auth", tags=["Authentication"])
@app.get("/")
async def root():
"""Корневой endpoint системы"""
return {
"message": "MasterPol Partner Management System API",
"version": "1.0.0",
"description": "Система управления партнерами согласно ТЗ демонстрационного экзамена"
}
@app.get("/health")
async def health_check():
"""Проверка здоровья приложения"""
return {"status": "healthy"}