veza/docs/archive/PLAN_V0_401_IMPLEMENTATION.md

112 lines
5.2 KiB
Markdown

# Plan d'implémentation v0.401 — Phase 4 Commerce
**Version cible** : v0.401
**Objectif** : Marketplace catalogue complet, licences & droits, seller dashboard enrichi
**Référence** : [V0_401_RELEASE_SCOPE.md](V0_401_RELEASE_SCOPE.md)
**Dernière mise à jour** : février 2026
---
## Diagramme de dépendances v0.401
```mermaid
flowchart TD
subgraph Backend [veza-backend-api]
M1_B[M1 Migrations + routes produits]
M2_B[M2 Tables licences + routes]
M3_B[M3 Routes /sell/stats enrichies]
end
subgraph Frontend [apps/web]
M1_F[CreateProductView ProductDetailView MarketplaceHome]
M2_F[LicenceCard LicenceDetailsModal LicensesView]
M3_F[SellerDashboardView graphiques]
end
M1_B --> M1_F
M1_B --> M2_B
M2_B --> M2_F
M3_B --> M3_F
```
---
## Phase 0 — Vérification préalable
| # | Tâche | Fichiers | Commit suggéré |
|---|-------|----------|----------------|
| 0.1 | Vérifier schéma DB marketplace existant | `veza-backend-api/migrations/` | — |
| 0.2 | Vérifier routes marketplace/sell actuelles | `routes_marketplace.go`, `sell_handlers.go` | — |
| 0.3 | Vérifier CreateProductView, SellerDashboardView | `apps/web/src/components/` | — |
---
## Phase 1 — Lot M1 (Produits & Catalogue)
| # | Tâche | Fichiers | Commit suggéré |
|---|-------|----------|----------------|
| 1.1 | Migration product_previews | `migrations/092_*.sql` | `feat(marketplace): add product_previews migration` |
| 1.2 | Migration product_images | `migrations/093_*.sql` | `feat(marketplace): add product_images migration` |
| 1.3 | Route POST /products/:id/preview | `marketplace/service.go`, handlers | `feat(marketplace): add product preview upload` |
| 1.4 | BPM/Key, catégories dans produits | Migration ou alter, service | `feat(marketplace): add bpm, musical_key, category to products` |
| 1.5 | CreateProductView : upload preview, catégories | `CreateProductView.tsx` | `feat(marketplace): enrich CreateProductView` |
| 1.6 | ProductDetailView : galerie images, preview jouable | `ProductDetailView.tsx` | `feat(marketplace): add images and preview to ProductDetailView` |
| 1.7 | MarketplaceHome : filtres BPM, key, catégorie | `MarketplaceHome.tsx`, `marketplaceService.ts` | `feat(marketplace): add filters to MarketplaceHome` |
**Validation** : `go test ./...`, `npm run build`, test manuel upload preview.
---
## Phase 2 — Lot M2 (Licences & Droits)
| # | Tâche | Fichiers | Commit suggéré |
|---|-------|----------|----------------|
| 2.1 | Migration product_licenses, user_licenses | `migrations/094_*.sql`, `095_*.sql` | `feat(marketplace): add licenses migrations` |
| 2.2 | Service licences (types, conditions) | `marketplace/service.go` | `feat(marketplace): add license types and terms` |
| 2.3 | Route GET /marketplace/licenses/mine | Handler + service | `feat(marketplace): add user licenses endpoint` |
| 2.4 | LicenceCard : types, conditions | `LicenceCard.tsx`, `LicenceDetailsModal.tsx` | `feat(marketplace): enrich LicenceCard with types` |
| 2.5 | Page ou section « Mes licences » | `LicensesView` ou `PurchasesView` | `feat(marketplace): add LicensesView` |
**Validation** : Achat (ou mock) → licence enregistrée → re-téléchargement visible.
---
## Phase 3 — Lot M3 (Seller dashboard enrichi)
| # | Tâche | Fichiers | Commit suggéré |
|---|-------|----------|----------------|
| 3.1 | GET /sell/stats/evolution (revenus par période) | `commerce_service.go`, `sell_handlers.go` | `feat(seller): add stats evolution endpoint` |
| 3.2 | GET /sell/stats/top-products | Idem | `feat(seller): add top products endpoint` |
| 3.3 | SellerDashboardView : graphique évolution | Recharts ou Chart.js | `feat(seller): add sales evolution chart` |
| 3.4 | Section « Meilleurs produits » | `SellerDashboardView.tsx` | `feat(seller): add top products section` |
| 3.5 | Taux de conversion (si données) | Backend + frontend | `feat(seller): add conversion rate` |
**Validation** : Données réelles ou MSW → graphiques affichés.
---
## Phase 4 — Finalisation
| # | Tâche | Fichiers | Commit suggéré |
|---|-------|----------|----------------|
| 4.1 | MSW handlers pour nouvelles routes | `apps/web/src/mocks/handlers.ts` | `test(marketplace): add MSW handlers for v0.401` |
| 4.2 | Stories Storybook (Loading, Error, Empty) | Composants modifiés | `feat(marketplace): add stories for v0.401 components` |
| 4.3 | Mise à jour CHANGELOG v0.401 | `CHANGELOG.md` | `docs: update CHANGELOG for v0.401` |
| 4.4 | Vérification SCOPE_CONTROL, FEATURE_STATUS | — | — |
---
## Ordre d'exécution recommandé
1. **Phase 0** — Vérification (30 min)
2. **Phase 1** — M1 Produits & Catalogue (4-5 j)
3. **Phase 2** — M2 Licences (3-4 j)
4. **Phase 3** — M3 Seller enrichi (3-4 j)
5. **Phase 4** — Finalisation (0.5-1 j)
---
## Références
- [V0_401_RELEASE_SCOPE.md](V0_401_RELEASE_SCOPE.md) — Scope détaillé
- [veza-backend-api/internal/core/marketplace/](../veza-backend-api/internal/core/marketplace/) — Service marketplace
- [apps/web/src/components/seller/](../apps/web/src/components/seller/) — Composants seller
- [STORYBOOK_CONTRACT.md](../apps/web/docs/STORYBOOK_CONTRACT.md) — Contrat Storybook