Skip to content

Public API routes for News and Senators#41

Merged
calebyhan merged 1 commit intomainfrom
feat/public-api-routes
Mar 3, 2026
Merged

Public API routes for News and Senators#41
calebyhan merged 1 commit intomainfrom
feat/public-api-routes

Conversation

@emlijon
Copy link
Copy Markdown
Contributor

@emlijon emlijon commented Mar 3, 2026

Hopefully will work well with the Pydantic Schemas — Public Output DTOs that Gabriel worked on. If not, I can come back and look at it.

  • Add GET /api/news (paginated, published only, most-recent-first)
  • Add GET /api/news/{id} (404 for drafts or nonexistent)
  • Add GET /api/senators (filterable: search, district_id, committee, session)
  • Add GET /api/senators/{id} (with committee assignments, any session)
  • Add app/utils/pagination.py reusable paginate() helper
  • Add app/schemas/pagination.py PaginatedResponse[T] generic envelope
  • Register both routers in app/main.py
  • Add try/except guard for PR Pydantic Schemas — Public Output DTOs #37 NewsDTO/SenatorDTO schemas
  • Add tests/routes/ integration test suite (43 tests, SQLite in-memory)
    • 13 tests for news endpoints
    • 26 tests for senator endpoints
    • conftest seeds districts, admin, news, committees, senators, memberships

Closes #6

- Add GET /api/news (paginated, published only, most-recent-first)
- Add GET /api/news/{id} (404 for drafts or nonexistent)
- Add GET /api/senators (filterable: search, district_id, committee, session)
- Add GET /api/senators/{id} (with committee assignments, any session)
- Add app/utils/pagination.py reusable paginate() helper
- Add app/schemas/pagination.py PaginatedResponse[T] generic envelope
- Register both routers in app/main.py
- Add try/except guard for PR #37 NewsDTO/SenatorDTO schemas
- Add tests/routes/ integration test suite (43 tests, SQLite in-memory)
  - 13 tests for news endpoints
  - 26 tests for senator endpoints
  - conftest seeds districts, admin, news, committees, senators, memberships

126 tests pass, 0 failures
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

Test Results

204 tests  +43   204 ✅ +43   0s ⏱️ ±0s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 7a02caf. ± Comparison against base commit 564ae2c.

Copy link
Copy Markdown
Contributor

@calebyhan calebyhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! thanks

@calebyhan calebyhan merged commit 17ac720 into main Mar 3, 2026
3 checks passed
@calebyhan calebyhan deleted the feat/public-api-routes branch March 3, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public API Routes — News & Senators

2 participants