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
42 lines
908 B
Python
42 lines
908 B
Python
"""Pydantic request/response schemas for newzy."""
|
|
|
|
from schemas.article import (
|
|
ArticleAdminList,
|
|
ArticleBase,
|
|
ArticleCreate,
|
|
ArticleRead,
|
|
ArticleUpdate,
|
|
)
|
|
from schemas.auth import LoginIn, RegisterIn, TokenOut, UserOut
|
|
from schemas.author import AuthorBase, AuthorCreate, AuthorRead, AuthorUpdate
|
|
from schemas.category import (
|
|
CategoryBase,
|
|
CategoryCreate,
|
|
CategoryRead,
|
|
CategoryUpdate,
|
|
)
|
|
from schemas.common import ErrorDetail, HealthResponse, VersionResponse
|
|
|
|
__all__ = [
|
|
"ArticleAdminList",
|
|
"ArticleBase",
|
|
"ArticleCreate",
|
|
"ArticleRead",
|
|
"ArticleUpdate",
|
|
"AuthorBase",
|
|
"AuthorCreate",
|
|
"AuthorRead",
|
|
"AuthorUpdate",
|
|
"CategoryBase",
|
|
"CategoryCreate",
|
|
"CategoryRead",
|
|
"CategoryUpdate",
|
|
"ErrorDetail",
|
|
"HealthResponse",
|
|
"LoginIn",
|
|
"RegisterIn",
|
|
"TokenOut",
|
|
"UserOut",
|
|
"VersionResponse",
|
|
]
|