claude code

This commit is contained in:
2026-01-28 19:22:30 +01:00
parent f9b1d43c81
commit bdbfa4e25a
104 changed files with 9591 additions and 261 deletions

View File

@@ -10,15 +10,33 @@ Décrit les entités clés et leurs relations.
---
## Entités principales
- Entité : <A COMPLETER PAR AGENT>
- Champs : <A COMPLETER PAR AGENT>
- Contraintes : <A COMPLETER PAR AGENT>
### Item (objet d'inventaire)
- Champs : `id` (PK), `name` (string, requis), `description` (text, optionnel), `quantity` (int, défaut 1), `price` (decimal, optionnel), `purchase_date` (date, optionnel), `status` (enum: in_stock/in_use/broken/sold, défaut in_stock), `location_id` (FK Location), `category_id` (FK Category), `created_at`, `updated_at` <!-- complété par codex -->
- Contraintes : `name` unique par location, `quantity` >= 0, `price` >= 0, index sur `name` + `status` pour recherche <!-- complété par codex -->
### Location (emplacement physique hiérarchique)
- Champs : `id` (PK), `name` (string, requis), `type` (enum: room/furniture/drawer/box), `parent_id` (FK Location, self-reference, optionnel), `path` (string, chemin complet calculé), `created_at`, `updated_at` <!-- complété par codex -->
- Contraintes : `name` unique par `parent_id`, pas de cycle dans hiérarchie (validation applicative), index sur `path` pour recherche hiérarchique <!-- complété par codex -->
### Category (domaine/catégorie)
- Champs : `id` (PK), `name` (string, requis, unique), `slug` (string, requis, unique), `description` (text, optionnel), `color` (string hex, optionnel), `icon` (string, optionnel), `created_at`, `updated_at` <!-- complété par codex -->
- Contraintes : `name` et `slug` uniques, slug kebab-case, catégories prédéfinies (bricolage, informatique, électronique, cuisine) + possibilité ajout <!-- complété par codex -->
### Document (fichier attaché)
- Champs : `id` (PK), `item_id` (FK Item, requis), `type` (enum: photo/notice/invoice/other), `filename` (string, requis), `filepath` (string, chemin relatif dans uploads/), `mime_type` (string), `size_bytes` (int), `uploaded_at` <!-- complété par codex -->
- Contraintes : `filepath` unique, index sur `item_id`, taille max 50MB par fichier, types MIME autorisés (images, PDF) <!-- complété par codex -->
## Relations
- Relation : <A COMPLETER PAR AGENT>
- Cardinalité : <A COMPLETER PAR AGENT>
---
- **Item N..1 Location** : Un item est dans une location, une location contient plusieurs items (CASCADE DELETE optionnel) <!-- complété par codex -->
- **Item N..1 Category** : Un item appartient à une catégorie, une catégorie contient plusieurs items (RESTRICT DELETE) <!-- complété par codex -->
- **Item 1..N Document** : Un item a plusieurs documents, un document appartient à un item (CASCADE DELETE) <!-- complété par codex -->
- **Location N..1 Location (self)** : Hiérarchie parent/enfant (garage → étagère → boîte), `parent_id` NULL pour racine (RESTRICT DELETE pour éviter orphelins) <!-- complété par codex -->
## Exemple (a supprimer)
- `User` 1..N `Order`.
## Indexation recherche (SQLite FTS5)
- **fts_items** : Table virtuelle FTS5 sur `Item.name` + `Item.description` + `Category.name` + `Location.path` pour recherche full-text performante <!-- complété par codex -->
- Synchronisation : Triggers SQLite pour maintenir FTS5 à jour lors des INSERT/UPDATE/DELETE sur Item <!-- complété par codex -->
---