diff --git a/DEPLOY.md b/DEPLOY.md index 464fcae..d61362b 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -12,7 +12,7 @@ inventory.malio-dev.fr/api → Backend Symfony (PHP-FPM derrière Nginx) | Composant | Technologie | Emplacement serveur | |-----------|-------------|---------------------| | Backend | Symfony 8 + API Platform | `/var/www/Inventory/` | -| Frontend | Nuxt 4 (site statique) | `/var/www/Inventory/Inventory_frontend/.output/public/` | +| Frontend | Nuxt 4 (site statique) | `/var/www/Inventory/frontend/.output/public/` | | Base de données | PostgreSQL 16 | Base `inventory` | ### Schéma simplifié @@ -117,7 +117,7 @@ php bin/console doctrine:migrations:migrate --no-interaction ### 4. Configurer le frontend Nuxt ```bash -cd /var/www/Inventory/Inventory_frontend +cd /var/www/Inventory/frontend # Permissions sudo chown -R malio:malio . @@ -173,7 +173,7 @@ server { # Frontend statique — tout le reste location / { - root /var/www/Inventory/Inventory_frontend/.output/public; + root /var/www/Inventory/frontend/.output/public; index index.html; try_files $uri $uri/ /index.html; # SPA fallback } @@ -214,7 +214,7 @@ php bin/console cache:clear --env=prod sudo chown -R www-data:www-data var/ # Frontend -cd Inventory_frontend +cd frontend npm install npx nuxi generate ``` @@ -268,7 +268,7 @@ php /var/www/Inventory/bin/console cache:clear --env=prod Les fichiers statiques sont en cache. Rebuilder : ```bash -cd /var/www/Inventory/Inventory_frontend +cd /var/www/Inventory/frontend rm -rf .output npx nuxi generate ``` @@ -299,7 +299,7 @@ tail -f /var/www/Inventory/var/log/prod.log php /var/www/Inventory/bin/console cache:clear --env=prod # Rebuild frontend -cd /var/www/Inventory/Inventory_frontend && npx nuxi generate +cd /var/www/Inventory/frontend && npx nuxi generate # Status des services systemctl status php8.4-fpm diff --git a/RELEASE.md b/RELEASE.md index 11e19d0..e58d2dc 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -59,7 +59,7 @@ Après avoir exécuté le script : ```bash # Pousser le frontend d'abord (si modifié) -cd Inventory_frontend && git push && git push --tags && cd .. +cd frontend && git push && git push --tags && cd .. # Pousser le backend git push && git push --tags @@ -79,7 +79,7 @@ git push && git push --tags |---------|------| | `VERSION` | Source unique de vérité | | `config/packages/api_platform.yaml` | Version affichée dans la doc API (Swagger) | -| `Inventory_frontend/nuxt.config.ts` | Lit `VERSION` au build pour l'afficher dans le footer | +| `frontend/nuxt.config.ts` | Lit `VERSION` au build pour l'afficher dans le footer | | Footer de l'app | Affiche `v{{ appVersion }}` | ## Notes de release @@ -118,5 +118,5 @@ git submodule update --init --recursive composer install --no-dev --optimize-autoloader php bin/console doctrine:migrations:migrate --no-interaction php bin/console cache:clear --env=prod -cd Inventory_frontend && npm install && npx nuxi generate +cd frontend && npm install && npx nuxi generate ``` diff --git a/docs/REVIEW_ARCHITECTURE.md b/docs/REVIEW_ARCHITECTURE.md index 5440a1e..bf64911 100644 --- a/docs/REVIEW_ARCHITECTURE.md +++ b/docs/REVIEW_ARCHITECTURE.md @@ -103,10 +103,10 @@ Cela securise l'integrite sans changer l'architecture. Le `resolveTarget` et les ### 3. Composables frontend geants (400-550 LOC) **Fichiers concernes :** -- `/Inventory_frontend/app/composables/useComponentEdit.ts` (550 LOC) -- `/Inventory_frontend/app/composables/usePieceEdit.ts` (472 LOC) -- `/Inventory_frontend/app/composables/useMachineDetailData.ts` (468 LOC) -- `/Inventory_frontend/app/composables/useComponentCreate.ts` (417 LOC) +- `/frontend/app/composables/useComponentEdit.ts` (550 LOC) +- `/frontend/app/composables/usePieceEdit.ts` (472 LOC) +- `/frontend/app/composables/useMachineDetailData.ts` (468 LOC) +- `/frontend/app/composables/useComponentCreate.ts` (417 LOC) **Probleme :** Ces composables orchestrent en un seul fichier : le chargement de donnees, la gestion de formulaire, la persistence des custom fields, la gestion des documents, l'historique, la resolution de labels, et la soumission. Chacun instancie 8-12 sous-composables. @@ -134,9 +134,9 @@ Appliquer le meme pattern a `usePieceEdit` et `useComponentCreate`. Les blocs co ### 4. Triple duplication de la logique custom fields frontend **Fichiers concernes :** -- `/Inventory_frontend/app/shared/utils/customFieldFormUtils.ts` (404 LOC) - pour les pages create/edit -- `/Inventory_frontend/app/shared/utils/customFieldUtils.ts` (440 LOC) - pour la page machine detail -- `/Inventory_frontend/app/shared/utils/entityCustomFieldLogic.ts` (335 LOC) - pour les composants item +- `/frontend/app/shared/utils/customFieldFormUtils.ts` (404 LOC) - pour les pages create/edit +- `/frontend/app/shared/utils/customFieldUtils.ts` (440 LOC) - pour la page machine detail +- `/frontend/app/shared/utils/entityCustomFieldLogic.ts` (335 LOC) - pour les composants item **Probleme :** Ces 3 fichiers resolvent le meme probleme (normaliser des definitions de custom fields + merger avec des valeurs existantes) avec des implementations differentes : - `customFieldFormUtils.ts` : `resolveFieldName()`, `resolveFieldType()`, `buildCustomFieldInputs()` @@ -273,7 +273,7 @@ public function process(mixed $data, Operation $operation, ...): mixed ### 9. Dependance circulaire dans `useMachineDetailData` **Fichier concerne :** -- `/Inventory_frontend/app/composables/useMachineDetailData.ts` (lignes 119-187) +- `/frontend/app/composables/useMachineDetailData.ts` (lignes 119-187) **Probleme :** `useMachineDetailProducts` a besoin de `machineProductLinks` (venant de hierarchy), et `useMachineDetailHierarchy` a besoin de `findProductById` (venant de products). La solution actuelle utilise un `_machineProductLinksProxy` ref avec un watcher pour synchroniser. diff --git a/docs/superpowers/plans/2026-03-12-json-to-tables-normalization.md b/docs/superpowers/plans/2026-03-12-json-to-tables-normalization.md index 47f703b..de5b4d3 100644 --- a/docs/superpowers/plans/2026-03-12-json-to-tables-normalization.md +++ b/docs/superpowers/plans/2026-03-12-json-to-tables-normalization.md @@ -811,9 +811,9 @@ private function resolvePieceQuantity(MachinePieceLink $pieceLink): int ### Task 2.5: Update Frontend to Handle New Structure Format **Files:** -- Modify: `Inventory_frontend/app/composables/useMachineHierarchy.ts` — `buildMachineHierarchyFromLinks()` -- Modify: `Inventory_frontend/app/shared/utils/structureDisplayUtils.ts` -- Modify: `Inventory_frontend/app/shared/utils/structureSelectionUtils.ts` +- Modify: `frontend/app/composables/useMachineHierarchy.ts` — `buildMachineHierarchyFromLinks()` +- Modify: `frontend/app/shared/utils/structureDisplayUtils.ts` +- Modify: `frontend/app/shared/utils/structureSelectionUtils.ts` **Note:** The API response shape for `structure` stays the same (pieces/subcomponents/products arrays), so frontend changes should be minimal. The main change is that `path` fields are removed and `resolvedPiece` is now always populated inline. @@ -950,7 +950,7 @@ ALTER TABLE pieces DROP COLUMN IF EXISTS productids; ### Task 4.1: Update Frontend Types **Files:** -- Modify: `Inventory_frontend/app/shared/types/` (if type definitions reference structure/skeleton JSON shapes) +- Modify: `frontend/app/shared/types/` (if type definitions reference structure/skeleton JSON shapes) - [ ] **Step 1: Search frontend for all references to `structure.pieces`, `structure.subcomponents`, `structure.products`, `skeleton`, `productIds`** diff --git a/docs/superpowers/plans/2026-03-12-piece-quantity.md b/docs/superpowers/plans/2026-03-12-piece-quantity.md index 6d69b09..f11e5bf 100644 --- a/docs/superpowers/plans/2026-03-12-piece-quantity.md +++ b/docs/superpowers/plans/2026-03-12-piece-quantity.md @@ -274,15 +274,15 @@ git commit -m "test(piece) : add quantity tests for MachinePieceLink" ### Task 4: TypeScript Types + Sanitization + Hydration Functions **Files:** -- Modify: `Inventory_frontend/app/shared/types/inventory.ts` -- Modify: `Inventory_frontend/app/shared/model/componentStructure.ts` -- Modify: `Inventory_frontend/app/shared/model/componentStructureSanitize.ts` -- Modify: `Inventory_frontend/app/shared/model/componentStructureHydrate.ts` -- Modify: `Inventory_frontend/app/shared/utils/structureAssignmentHelpers.ts` +- Modify: `frontend/app/shared/types/inventory.ts` +- Modify: `frontend/app/shared/model/componentStructure.ts` +- Modify: `frontend/app/shared/model/componentStructureSanitize.ts` +- Modify: `frontend/app/shared/model/componentStructureHydrate.ts` +- Modify: `frontend/app/shared/utils/structureAssignmentHelpers.ts` - [ ] **Step 1: Add `quantity` to `ComponentModelPiece` type** -In `Inventory_frontend/app/shared/types/inventory.ts`, add `quantity` to the `ComponentModelPiece` interface (after `role`, line ~23): +In `frontend/app/shared/types/inventory.ts`, add `quantity` to the `ComponentModelPiece` interface (after `role`, line ~23): ```typescript quantity?: number @@ -290,7 +290,7 @@ quantity?: number - [ ] **Step 2: Add `quantity` to `validatePiece()` in same file** -In `Inventory_frontend/app/shared/types/inventory.ts`, in `validatePiece()` (line ~144-172): +In `frontend/app/shared/types/inventory.ts`, in `validatePiece()` (line ~144-172): After `const role = ensureString(value.role)` (line ~161), add: @@ -306,7 +306,7 @@ And in the return object, add after the `role` spread: - [ ] **Step 3: Update `sanitizePieces()` to preserve quantity** -In `Inventory_frontend/app/shared/model/componentStructureSanitize.ts`, in `sanitizePieces()` (~line 130-188). +In `frontend/app/shared/model/componentStructureSanitize.ts`, in `sanitizePieces()` (~line 130-188). After the existing field extractions, add: @@ -324,7 +324,7 @@ if (quantity !== undefined) { - [ ] **Step 4: Update `normalizeStructureForSave()` to include quantity** -In `Inventory_frontend/app/shared/model/componentStructure.ts`, in `normalizeStructureForSave()` (~lines 164-179), add in the piece payload mapping after the `reference` check: +In `frontend/app/shared/model/componentStructure.ts`, in `normalizeStructureForSave()` (~lines 164-179), add in the piece payload mapping after the `reference` check: ```typescript if ((piece as any).quantity !== undefined && (piece as any).quantity >= 1) { @@ -336,7 +336,7 @@ if ((piece as any).quantity !== undefined && (piece as any).quantity >= 1) { - [ ] **Step 5: Update `hydratePieces()` and `mapComponentPieces()` to preserve quantity** -In `Inventory_frontend/app/shared/model/componentStructureHydrate.ts`: +In `frontend/app/shared/model/componentStructureHydrate.ts`: In `hydratePieces()` (line ~95-107), add to the mapped object: @@ -352,7 +352,7 @@ In `mapComponentPieces()` (line ~168-179), add to the mapped object: - [ ] **Step 6: Update `sanitizePieceDefinition()` to preserve quantity** -In `Inventory_frontend/app/shared/utils/structureAssignmentHelpers.ts`, in `sanitizePieceDefinition()` (~lines 172-180), add to the `stripNullish()` object: +In `frontend/app/shared/utils/structureAssignmentHelpers.ts`, in `sanitizePieceDefinition()` (~lines 172-180), add to the `stripNullish()` object: ```typescript quantity: typeof (definition as any).quantity === 'number' ? (definition as any).quantity : null, @@ -361,14 +361,14 @@ quantity: typeof (definition as any).quantity === 'number' ? (definition as any) - [ ] **Step 7: Run lint + typecheck** ```bash -cd Inventory_frontend && npm run lint:fix && npx nuxi typecheck +cd frontend && npm run lint:fix && npx nuxi typecheck ``` Expected: 0 errors - [ ] **Step 8: Commit** ```bash -cd Inventory_frontend +cd frontend git add app/shared/types/inventory.ts app/shared/model/componentStructure.ts app/shared/model/componentStructureSanitize.ts app/shared/model/componentStructureHydrate.ts app/shared/utils/structureAssignmentHelpers.ts git commit -m "feat(piece) : add quantity field to piece types, sanitization and hydration" ``` @@ -378,14 +378,14 @@ git commit -m "feat(piece) : add quantity field to piece types, sanitization and ### Task 5: Composant Structure Editor — Quantity Input **Files:** -- Modify: `Inventory_frontend/app/components/StructureNodeEditor.vue` (piece section, lines ~229-299) -- Modify: `Inventory_frontend/app/composables/useStructureNodeCrud.ts` (`addPiece()`, lines ~110-118) +- Modify: `frontend/app/components/StructureNodeEditor.vue` (piece section, lines ~229-299) +- Modify: `frontend/app/composables/useStructureNodeCrud.ts` (`addPiece()`, lines ~110-118) **Context:** `StructureNodeEditor.vue` renders the composant structure editor. The piece section (lines ~236-293) currently shows only a `select` for `typePieceId` and a delete button. The `addPiece()` function in `useStructureNodeCrud.ts` creates new piece entries with default fields. - [ ] **Step 1: Add default quantity to `addPiece()`** -In `Inventory_frontend/app/composables/useStructureNodeCrud.ts`, in `addPiece()` (line ~110-118), add `quantity: 1` to the pushed object: +In `frontend/app/composables/useStructureNodeCrud.ts`, in `addPiece()` (line ~110-118), add `quantity: 1` to the pushed object: ```typescript const addPiece = () => { @@ -403,7 +403,7 @@ const addPiece = () => { - [ ] **Step 2: Add quantity input in `StructureNodeEditor.vue`** -In `Inventory_frontend/app/components/StructureNodeEditor.vue`, in the piece item rendering section (inside the `v-for` loop for pieces, line ~256-292), add a quantity input next to the existing piece type `select`. Place it after the select and before the delete button: +In `frontend/app/components/StructureNodeEditor.vue`, in the piece item rendering section (inside the `v-for` loop for pieces, line ~256-292), add a quantity input next to the existing piece type `select`. Place it after the select and before the delete button: ```vue ` tag. Quantity should appear as "×N" after the name, in secondary text. For direct pieces (no parent component), it should be editable. For composant pieces, read-only. - [ ] **Step 1: Add quantity display to PieceItem** -In `Inventory_frontend/app/components/PieceItem.vue`, after the piece name in the `