Docs: bring all documentation current with v0.8.1
Build and Push Docker Image / build (push) Successful in 16s

- README: v0.8.1 highlights, Node 18+ requirement + client install step for
  manual dev setup, health/genetics features listed, release summary updated
- API.md: paginated response shapes for dogs/litters, validation + status-code
  behavior (400/404), full breeding heat-cycle CRUD, genetics PUT/DELETE,
  pedigree COI/relations/cancer-lineage endpoints, corrected Litter object
- DEVELOPMENT.md: two-layer migration approach documented with schema-drift
  warning, heat_cycles/cancer_history tables, Toast/ConfirmDialog UI patterns
  (no alert/window.confirm), full env-var table, auth-deferred decision noted
- INSTALL.md: fixed API smoke-test (old /api/health root path doesn't exist),
  master -> main
- ROADMAP: v0.8.1 entry; Phase 4b checkboxes reconciled with what's actually
  built; Phase 6 progress; pre-deploy prod-DB check added to QA list

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jason Stedwell
2026-07-06 15:43:23 -05:00
parent f7a5e8ecb8
commit a06ddf0435
5 changed files with 165 additions and 83 deletions
+72 -19
View File
@@ -1,8 +1,9 @@
# BREEDR API Documentation (v0.8.0)
# BREEDR API Documentation (v0.8.1)
Base URL: `/api`
All endpoints return JSON responses. Errors follow the format `{ "error": "message" }`.
Validation failures return `400`, missing resources return `404`.
---
@@ -11,37 +12,46 @@ All endpoints return JSON responses. Errors follow the format `{ "error": "messa
Manage individual dogs in the kennel.
### `GET /`
Get active kennel dogs.
Get active kennel dogs (paginated).
- **Query Params**:
- `include_external=1`: Include external dogs (studs/others)
- `external_only=1`: Only show external dogs
- **Response**: Array of [Dog](#dog-object) objects with `sire` and `dam` attached.
- `page` (default 1), `limit` (default 50, max 200)
- `search`: Filter by name or registration number
- `sex`: `male` | `female`
- **Response**: `{ "data": [Dog...], "total", "page", "limit", "stats": { "total", "males", "females" } }` — each Dog has `sire` and `dam` attached.
### `GET /all`
Get all active dogs (kennel + external, unpaginated). Used for dropdowns/pairing/pedigree.
### `GET /:id`
Get single dog details.
- **Response**: [Dog](#dog-object) object including `sire`, `dam`, and `offspring` array.
- **Response**: [Dog](#dog-object) object including `sire`, `dam`, and `offspring` array. `404` if not found.
### `POST /`
Create a new dog.
- **Body**: See [Dog](#dog-object) fields. `name`, `breed`, `sex` are required.
- **Response**: The created Dog object.
- **Validation**: If `sire_id`/`dam_id` are provided they must reference an existing dog of the correct sex (sire → male, dam → female), else `400`. The dog + parent links are written in a single transaction.
- **Response**: The created Dog object (`201`).
### `PUT /:id`
Update an existing dog.
- **Body**: Dog fields to update.
- **Validation**: `404` if the dog doesn't exist. Same sire/dam checks as `POST /`, plus a dog cannot be its own parent.
- **Response**: The updated Dog object.
### `DELETE /:id`
Permanently delete a dog and its related records (health, heat, parents).
- **Response**: `{ "success": true, "message": "..." }`
Permanently delete a dog and its related records (health, heat cycles, parent links) in a single transaction.
- **Response**: `{ "success": true, "message": "..." }``404` if not found.
### `POST /:id/photos`
Upload a photo for a dog.
Upload a photo for a dog (JPEG/PNG/GIF/WebP, ≤ 10 MB).
- **Form-Data**: `photo` (file)
- **Response**: `{ "url": "...", "photos": [...] }`
### `DELETE /:id/photos/:photoIndex`
Delete a specific photo from a dog's photo array.
- **Validation**: `400` if `photoIndex` is not an integer within the photo array's bounds.
- **Response**: `{ "photos": [...] }`
---
@@ -51,8 +61,9 @@ Delete a specific photo from a dog's photo array.
Manage breeding litters and puppy logs.
### `GET /`
Get all litters.
- **Response**: Array of [Litter](#litter-object) objects with sire/dam names and puppies.
Get all litters (paginated).
- **Query Params**: `page` (default 1), `limit` (default 50)
- **Response**: `{ "data": [Litter...], "total", "page", "limit" }` with sire/dam names and puppies attached.
### `GET /:id`
Get single litter details.
@@ -61,10 +72,14 @@ Get single litter details.
### `POST /`
Create a new litter.
- **Body**: `sire_id`, `dam_id`, `breeding_date` (required), `whelping_date`, `puppy_count`, `notes`.
- **Validation**: Sire must be male, dam must be female.
- **Response**: The created Litter object.
### `PUT /:id`
Update litter details.
Update litter details (`breeding_date`, `whelping_date`, `puppy_count`, `notes` — parents cannot change).
### `DELETE /:id`
Delete a litter. Puppies are unlinked (their dog records are kept).
### `POST /:id/puppies/:puppyId`
Link a dog to a litter as a puppy.
@@ -77,8 +92,11 @@ Remove a puppy from a litter (sets `litter_id` to NULL).
Get weight and health logs for a puppy.
### `POST /:litterId/puppies/:puppyId/logs`
Add a weight/health log entry.
- **Body**: `record_date` (required), `weight_oz`, `weight_lbs`, `notes`, `record_type`.
Add a weight/health log entry (stored in `health_records`; weights serialized into `description`).
- **Body**: `record_date` (required), `weight_oz`, `weight_lbs`, `notes`, `record_type` (default `weight_log`).
### `DELETE /:litterId/puppies/:puppyId/logs/:logId`
Delete a weight/health log entry.
---
@@ -143,9 +161,18 @@ Get the full genetic panel for a dog. Returns `tests` (actual records) and `pane
Check genetic compatibility between two dogs.
- **Response**: `{ risks: [...], safe_to_pair: boolean }`
### `GET /:id`
Get a single genetic test record.
### `POST /`
Add a genetic test result.
- **Body**: `dog_id`, `marker`, `result` (clear|carrier|affected|not_tested).
- **Body**: `dog_id`, `marker`, `result` (clear|carrier|affected|not_tested), plus optional `test_provider`, `test_date`, `document_url`, `notes`.
### `PUT /:id`
Update a genetic test result.
### `DELETE /:id`
Delete a genetic test result.
---
@@ -153,14 +180,27 @@ Add a genetic test result.
Track heat cycles and whelping projections.
### `GET /heat-cycles`
Get all heat cycles (with dog info). Optional `?year=YYYY&month=M` filter.
### `GET /heat-cycles/active`
Get currently active heat cycles.
### `GET /heat-cycles/dog/:dogId`
Get all heat cycles for a specific dog.
### `GET /heat-cycles/:id/suggestions`
Get optimal breeding window (days 9-15) and whelping projections.
### `POST /heat-cycles`
Log a new heat cycle. Dog must be female.
- **Body**: `dog_id`, `start_date` (required), `end_date`, `breeding_date`, `breeding_successful`, `notes`.
### `PUT /heat-cycles/:id`
Update a heat cycle (same body as `POST`, minus `dog_id`).
### `DELETE /heat-cycles/:id`
Delete a heat cycle.
### `GET /whelping-calculator?breeding_date=YYYY-MM-DD`
Standalone tool to calculate expected whelping window.
@@ -178,10 +218,19 @@ Get an interactive pedigree tree (ancestors). Default 5 generations.
Get a descendant tree. Default 3 generations.
### `POST /trial-pairing`
Calculate Coefficient of Inbreeding (COI) for a hypothetical mating.
Calculate Coefficient of Inbreeding (COI) for a hypothetical mating. (`POST /coi` is an alias.)
- **Body**: `sire_id`, `dam_id`.
- **Response**: `{ coi, commonAncestors, directRelation, recommendation }`
### `GET /:id/coi`
Get the COI for an existing dog (computed from its actual parents).
### `GET /relations/:sireId/:damId`
Check the direct relationship between two dogs (parent/offspring, siblings, etc.).
### `GET /:id/cancer-lineage`
Cancer history aggregated across a dog's lineage.
---
## 7. Settings (`/api/settings`)
@@ -223,9 +272,13 @@ Update kennel settings.
"id": 5,
"sire_id": 1,
"dam_id": 2,
"breeding_date": "2023-01-01",
"whelp_date": "2023-03-05",
"total_count": 8,
"puppies": [ ... ]
"sire_name": "Sire Name",
"dam_name": "Dam Name",
"breeding_date": "2026-01-01",
"whelping_date": "2026-03-05",
"puppy_count": 8,
"notes": null,
"puppies": [ ... ],
"actual_puppy_count": 8
}
```