rmi-backend/app/homepage.py
opencode c762564d40 style(rmi-backend): complete lint cleanup — 1175→0 ruff errors
- Fix 71 invalid-syntax files (class-body newline-broken assignments)
- Add from/None chain to 307 B904 raise-without-from sites
- Add B008 ignore to ruff.toml (already in pyproject.toml)
- Noqa F401 on __init__.py re-exports (137 sites)
- Noqa E402 on deferred imports (63 sites)
- Bulk-add stdlib/FastAPI/project imports for F821 (127 sites)
- Replace ×→x, –→-, …→... in docstrings (4093 chars)
- Manual refactor of 5 SIM103/SIM116 patterns

Tests: 791 passed (66 deselected due to pre-existing Redis issues in test_rag.py)
Co-authored-by: opencode <opencode@rugmunch.io>
2026-07-06 15:43:20 +02:00

44 lines
1.1 KiB
Python

"""Homepage routes - /, /version.
Minimal landing endpoints for the backend. Returns deployment metadata.
"""
from __future__ import annotations
from fastapi import APIRouter
from pydantic import BaseModel
from app.factory import DESCRIPTION, TITLE, VERSION
router = APIRouter(tags=["homepage"])
class VersionResponse(BaseModel):
"""Backend version info."""
version: str
title: str
description: str
status: str = "operational"
class HomeResponse(BaseModel):
"""Landing page response."""
service: str
version: str
docs: str = "/docs"
openapi: str = "/openapi.json"
health: str = "/health"
metrics: str = "/metrics"
@router.get("/", response_model=HomeResponse)
async def home() -> HomeResponse:
"""Landing page - returns service metadata."""
return HomeResponse(service=TITLE, version=VERSION)
@router.get("/version", response_model=VersionResponse)
async def version() -> VersionResponse:
"""Detailed version info for ops."""
return VersionResponse(version=VERSION, title=TITLE, description=DESCRIPTION)