Establish Git-first TasksNest documentation and audit baseline

This commit is contained in:
Joren de Graaf
2026-11-06 14:12:29 +01:00
parent 01133370e6
commit 1a63241fb6
17 changed files with 527 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
# Data model map
Models are in each app's `models.py`; migrations, not this page, define the deployed schema. Most personal records reference Django's auth user. UUID API identifiers often coexist with integer database primary keys. Verify exact constraints and `on_delete` rules before writing data migrations.
| App | Models and purpose |
| --- | --- |
| `planner` | `Task`, `TaskOccurrence`, `TaskOccurrenceEvent`, `TaskWeatherShift` manage scheduling; `UserSettings`, fasting and water models hold user settings and tracking; workout, pain, tooth, bowel and sleep models record health events. |
| `food` | `FoodProduct`, `FoodPortion`, `FoodLogEntry`, `FoodLogAttachment`, `FoodFavourite`; `KitchenInventoryItem`, package/consumption and scanner models; `CanonicalIngredient`, nutrition import/source/review, suggestions and links; `DietaryPreference`, exception and audit; OAuth PAT, idempotency, housekeeping and Open Food Facts records. |
| `recipes` | `Recipe`, ingredient, substitution, subrecipe and link models; selection and cook-later records; stock use lines and cooking runs. |
| `groceries` | `GroceryItem`, `GrocerySource`, `GroceryRecipeDemand` connect shopping entries to recipe demand and inventory transfer. |
| `home_assistant` | `HomeAssistantConnection`, `HomeAssistantSyncRun`, `HomeAssistantItemMap` store connection, sync history and stable mapping. |
| `stress`, `dreams` | `StressEntry`, `DreamEntry` store private journal records. |
Key cross-app relations: recipe ingredients can point to food products; recipe stock-use lines reference inventory consumption; grocery items can point to products and recipe demand; food diary entries snapshot nutrition so later recipe/product edits do not rewrite history. Recipe links are suggestions; subrecipes are composition. See [features](../features/overview.md).
Validation lives in model `clean()` methods, forms, API helpers and services, not solely database constraints. Examples include positive quantities and serving counts, no self-link and uniqueness for recipe links, ownership checks, dietary revision checks, and idempotency on creation. Use the relevant service/API tests when changing these rules.