Files
Daniel Samson afa399776f feat(admin): rebuild admin area around the Article domain
The admin area was managing a Hacker News-style Item model that the
public site never consumed, so the homepage always fell back to sample
data. Rebuild the admin area around the real public content model.

Backend:
- Remove the Item model, schema and admin API
- Admin API now manages articles at /api/v1/admin/articles (CRUD) with
  /api/v1/admin/authors and /api/v1/admin/categories reference data
- Add public read-only article endpoints (/api/v1/articles,
  /api/v1/articles/{id}): no auth, published-only, newest-first
- Rewrite Article schemas; ArticleRead embeds author and category
- Add idempotent seed_content.py dev seeder (3 authors, 4 categories,
  6 published articles)

Frontend:
- Admin UI rewritten around articles: AdminDashboard list, new
  EditArticlePage (create/edit, author/category selects, published
  toggle, Lexical editor, debounced auto-save)
- Replace AdminItem types and api client with the article domain
- Update App routes, AdminLayout sidebar, DeleteConfirmation, Lexical
  editor labels and Home/client comments to article terminology

Tests:
- Rewrite admin unit tests and the Playwright admin e2e spec for the
  article domain; add test_articles.py for the public endpoints and
  seeder
2026-10-31 18:31:05 +00:00

36 lines
1.1 KiB
Python

"""API v1 routes.
Mounted under ``/api/v1`` (see ``core.app.create_app``).
"""
from fastapi import APIRouter
from api.v1 import admin as admin_routes
from api.v1 import articles as articles_routes
from api.v1 import auth as auth_routes
from config import APP_NAME, APP_VERSION
from schemas import HealthResponse, VersionResponse
router = APIRouter()
# Public article feed (no auth) under /api/v1/articles.
router.include_router(articles_routes.router)
# Authentication (register / login / logout / me) under /api/v1/auth.
router.include_router(auth_routes.router)
# Admin area (article CRUD, admin-only) under /api/v1/admin.
router.include_router(admin_routes.router)
@router.get("/health", response_model=HealthResponse, summary="Service health check")
def get_health() -> HealthResponse:
"""Report service health (alternative path to the root ``/health``)."""
return HealthResponse(status="ok", version=APP_VERSION)
@router.get("/version", response_model=VersionResponse, summary="Application version")
def get_version() -> VersionResponse:
"""Return the application name and version."""
return VersionResponse(app=APP_NAME, version=APP_VERSION)