Enhancements
This commit is contained in:
+11
-1
@@ -1,6 +1,6 @@
|
||||
# TaskNest Food and Kitchen API v1
|
||||
|
||||
The API is intended for a future thin MCP adapter. It is available under `/api/v1/`; machine-readable OpenAPI 3.1 is at `/api/v1/schema/`. No MCP server or interactive production API UI is included.
|
||||
The API is available under `/api/v1/`; machine-readable OpenAPI 3.1 is at `/api/v1/schema/`. The MCP server uses these endpoints. There is no interactive production API UI.
|
||||
|
||||
## Authentication and permissions
|
||||
|
||||
@@ -21,6 +21,10 @@ Each resource lookup filters by the token owner. An unknown UUID and another use
|
||||
| DELETE | `/food/attachments/{id}/` | `food:write` | Delete an owned image |
|
||||
| GET/POST | `/kitchen/items/` | read/write | Search/list or create inventory item |
|
||||
| GET/PATCH/DELETE | `/kitchen/items/{id}/` | read/write | Own inventory item |
|
||||
| GET | `/hydration/daily/?date=YYYY-MM-DD` | `food:read` | Combined total, manual and Food Diary contributions, goal, and remaining amount |
|
||||
| POST | `/hydration/manual/` | `food:write` | Standalone fluid entry; optional `Idempotency-Key` |
|
||||
| PATCH/DELETE | `/hydration/manual/{id}/` | `food:write` | Correct or remove an owned manual fluid entry |
|
||||
| GET/PATCH | `/hydration/settings/` | read/write | Automatic counting, liquid foods, breakdown, manual adjustments, and beverage rules |
|
||||
|
||||
Collection responses use `count`, `limit`, `offset`, and `results`. The default limit is 30 and maximum is 100; `offset` is capped at 10,000. Product and inventory search checks name, brand, and barcode; inventory search also checks location and category. `GET /food/today/` is naturally bounded by one day.
|
||||
|
||||
@@ -32,6 +36,12 @@ For attachment upload, send multipart `image` and optional `caption`. JPEG, PNG,
|
||||
|
||||
POST creation routes accept an optional `Idempotency-Key` header. Repeating the same token, route, key, and body returns the stored result and creates no second record. Reusing a key with a different body or route returns 409. Keys are per token. JSON errors use `{"error":{"code":"...","message":"..."}}`; validation may include `details`. Common codes include `invalid_token`, `expired_token`, `insufficient_scope`, `entry_not_found`, `product_not_found`, `inventory_item_not_found`, `image_too_large`, and `unsupported_image_type`.
|
||||
|
||||
## Hydration accounting
|
||||
|
||||
Food Diary entries saved in millilitres can count toward hydration automatically. Each entry stores its eligible volume, counting factor, and classification source, so later product edits do not rewrite past totals. Grams are never converted to millilitres. Soup counting is off by default. Users can override a product's drink classification from the Food Diary. Manual entry timestamps use the user's local date; food contributions use the Food Diary date. Web and API food logging use the same calculation, so clients do not need a second hydration call.
|
||||
|
||||
For a packaged inventory item, `PATCH /kitchen/items/{id}/` may set `remaining_amount` to an absolute value from zero through its current remaining amount. A reduction uses the existing inventory consumption service; zero archives that package from active inventory. `opened`, `notes`, and other metadata can be sent in the same request. Increasing stock or exceeding the package capacity is rejected. Quantity validation errors return `error.details.field` and `error.details.reason`.
|
||||
|
||||
## Example requests
|
||||
|
||||
```sh
|
||||
|
||||
Reference in New Issue
Block a user