- Create heat_cycles table in init.js (breeding.js used it but nothing created it)
- Add litters columns the routes actually use (breeding_date, whelping_date, puppy_count)
- Add health_records columns used by puppy logs (record_date, description)
- Puppy log insert now also sets NOT NULL test_date
- Migration 002 no-ops on a fresh DB instead of crashing on missing dogs table
- init.js honors DB_PATH and creates the data dir, so migrations and the app
always target the same file
Verified: full heat-cycle/litter/puppy-log CRUD passes against a virgin database.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All list endpoints now accept ?page and ?limit (default 50, max 200) and
return { data, total, page, limit } instead of a bare array, preventing
memory and performance failures at scale.
- GET /api/dogs: adds pagination, server-side search (?search) and sex
filter (?sex), and a stats aggregate (total/males/females) for the
Dashboard to avoid counting from the array
- GET /api/litters: adds pagination; also fixes N+1 query by fetching
all puppies for the current page in a single query instead of one per
litter
- DogList: moves search/sex filtering server-side with 300ms debounce;
adds Prev/Next pagination controls
- LitterList: uses paginated response; adds Prev/Next pagination controls
- Dashboard: reads counts from stats/total fields instead of array length
- LitterDetail, LitterForm: switch dogs fetch to /api/dogs/all (complete
list, no pagination, for sire/dam dropdowns)
- DogForm: updates litters fetch to use paginated response shape
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>