39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Точка входа FastAPI."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.routes import admin, auth, journal, missions, onboarding, store, users
|
|
from app.core.config import settings
|
|
# Import all models to ensure they're registered with Base.metadata
|
|
from app import models # This imports all models through the __init__.py
|
|
|
|
app = FastAPI(title=settings.project_name)
|
|
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.backend_cors_origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(users.router)
|
|
app.include_router(missions.router)
|
|
app.include_router(journal.router)
|
|
app.include_router(onboarding.router)
|
|
app.include_router(store.router)
|
|
app.include_router(admin.router)
|
|
|
|
|
|
@app.get("/", summary="Проверка работоспособности")
|
|
def healthcheck() -> dict[str, str]:
|
|
"""Простой ответ для Docker healthcheck."""
|
|
|
|
return {"status": "ok"}
|