batches - BevvyTech/BrewskiDocs GitHub Wiki
| Method | Path | Description |
|---|---|---|
GET |
/batches |
Paginated batch listing with optional beer filter. |
POST |
/batches |
Create a new batch for a beer. |
PATCH |
/batches/:id |
Update batch details. |
GET |
/batches/:id/racking/activity |
Racking activity extracted from the activity log for a batch. |
-
Query Parameters:
-
teamId(uuid, required) -
beerId(uuid, optional) -
sort(brewDate | createdAt, default brewDate) -
direction(asc | desc, default desc) -
page,pageSize(≤ 200)
-
-
Response 200:
{ "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "beerId": null, "page": 1, "pageSize": 25, "total": 1, "pages": 1, "sort": "brewDate", "direction": "desc", "results": [ { "id": "b2410...", "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "beerId": "8f62...", "beerName": "Lantern Pale", "beer": { "id": "8f62...", "name": "Lantern Pale", "style": "Pale Ale", "state": "active", "targetAbv": 4.7, "colorHex": "#FFA500" }, "batchCode": "BATCH-2410", "brewDate": "2025-01-31", "originalGravity": "1.048", "finalGravity": "1.012", "measuredAbv": "4.7", "plannedVolume": 1000, "realVolume": 980, "notes": "Dry hop scheduled", "excelsior": false, "rating": null, "brewerId": "3f3fdd2e-1bab-49e3-9d24-8a2d0b307d1d", "brewerName": "Brew Master", "createdAt": "2025-01-31T09:30:00.000Z", "updatedAt": "2025-02-01T14:05:00.000Z" } ] }
- Auth: Bearer token. Caller must belong to the team.
-
Body: Requires
teamIdandbeerId.batchCodeis optional—when omitted, the API generates either an obscured code (#YYYYMMDD-XXXX) when the team’sobscureBatchCodesetting is enabled, or the next sequential integer (existing batches for the team + 1) when it is disabled. Other optional fields includebrewDate,originalGravity,finalGravity,measuredAbv,plannedVolume,realVolume,notes,excelsior,rating, andbrewerId. IfbrewerIdis omitted, the authenticated user is set as the brewer. -
Response 201:
{ "batch": { ... } }with generated fields.
-
Body: Accepts the same optional fields as creation plus
brewerId, which must reference an active member of the batch’s team. You can toggle theexcelsiorflag for standout batches and set a numericrating(0–9) or clear it withnull. -
Notes:
-
excelsiordefaults tofalse; use it to highlight exceptional runs. -
ratingdefaults tonulland only accepts integers between 0 and 9.
-
- Auth: Bearer token; caller must belong to the team that owns the batch.
-
Response 200:
{ "batchId": "b2410...", "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "results": [ { "id": "act-2001...", "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "userId": "3f3fdd2e-1bab-49e3-9d24-8a2d0b307d1d", "category": "production", "tableName": "batches", "itemId": "b2410...", "message": "Racking started for Lantern Pale: BATCH-2410", "metadata": { "type": "batch.racking.started", "code": "activity.batch.racking.started" }, "createdAt": "2025-02-10T09:00:00.000Z", "updatedAt": "2025-02-10T09:00:00.000Z" } ] } -
Notes:
- Results are sorted newest-first and limited to the latest 100 entries.
- Entries are filtered by activity metadata (
metadata.code/metadata.typeprefixes ofactivity.batch.rackingorbatch.racking) to isolate racking-specific events.