You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
News and Senators are the two most-visited public sections. Shipping these endpoints first allows the frontend team to integrate real data immediately and validates the full stack end-to-end (model → schema → route → response).
Deliverables
Create a reusable pagination utility (app/utils/pagination.py) that accepts page and limit query params and returns offset/limit + total count metadata
Implement GET /api/news — paginated, most recent first, only is_published=True
Implement GET /api/news/:id — single article, 404 if not found or not published
Implement GET /api/senators — filterable by search (name), district_id, committee (id), session (number); defaults to active senators in current session
Implement GET /api/senators/:id — single senator with committee assignments included
Motivation
News and Senators are the two most-visited public sections. Shipping these endpoints first allows the frontend team to integrate real data immediately and validates the full stack end-to-end (model → schema → route → response).
Deliverables
app/utils/pagination.py) that acceptspageandlimitquery params and returns offset/limit + total count metadataGET /api/news— paginated, most recent first, onlyis_published=TrueGET /api/news/:id— single article, 404 if not found or not publishedGET /api/senators— filterable bysearch(name),district_id,committee(id),session(number); defaults to active senators in current sessionGET /api/senators/:id— single senator with committee assignments includedapp/routers/news.py,app/routers/senators.pyapp/main.pyhttpx.AsyncClientwith a test databaseImportant Notes
{ items: [...], total: int, page: int, limit: int }committeefilter on/api/senatorsshould filter senators who are members of that committee (JOIN through CommitteeMembership)