Implement milestone M2 (backend setup):
- FastAPI app factory (core/app.py) with CORS, lifespan table
creation, and global error handlers using a standardized
{detail, code, errors?} envelope
- Endpoints: GET /health, GET /api/v1/health, GET /api/v1/version
- SQLAlchemy 2.0 ORM: Article, Author, Category models with
relationships, unique constraints, and FK pragma for SQLite
- Pydantic v2 schemas (create/update/read) for all models
- Env-driven config (DATABASE_URL, CORS_ORIGINS) + .env.example
- pytest suite (19 tests, ~95% coverage) with per-test SQLite
databases via fixtures
- Dockerfile (python:3.11-slim) and docker-compose.yml with a
persistent ./data/db volume and healthcheck
25 lines
692 B
Python
25 lines
692 B
Python
"""Pydantic request/response schemas for newzy."""
|
|
|
|
from schemas.article import ArticleBase, ArticleCreate, ArticleRead, ArticleUpdate
|
|
from schemas.author import AuthorBase, AuthorCreate, AuthorRead, AuthorUpdate
|
|
from schemas.category import CategoryBase, CategoryCreate, CategoryRead, CategoryUpdate
|
|
from schemas.common import ErrorDetail, HealthResponse, VersionResponse
|
|
|
|
__all__ = [
|
|
"ArticleBase",
|
|
"ArticleCreate",
|
|
"ArticleRead",
|
|
"ArticleUpdate",
|
|
"AuthorBase",
|
|
"AuthorCreate",
|
|
"AuthorRead",
|
|
"AuthorUpdate",
|
|
"CategoryBase",
|
|
"CategoryCreate",
|
|
"CategoryRead",
|
|
"CategoryUpdate",
|
|
"ErrorDetail",
|
|
"HealthResponse",
|
|
"VersionResponse",
|
|
]
|