refactor(docs): réorganiser la documentation selon principes DDD
Réorganise la documentation du projet selon les principes du Domain-Driven Design (DDD) pour améliorer la cohésion, la maintenabilité et l'alignement avec l'architecture modulaire du backend. **Structure cible:** ``` docs/domains/ ├── README.md (Context Map) ├── _shared/ (Core Domain) ├── recommendation/ (Supporting Subdomain) ├── content/ (Supporting Subdomain) ├── moderation/ (Supporting Subdomain) ├── advertising/ (Generic Subdomain) ├── premium/ (Generic Subdomain) └── monetization/ (Generic Subdomain) ``` **Changements effectués:** Phase 1: Création de l'arborescence des 7 bounded contexts Phase 2: Déplacement des règles métier (01-19) vers domains/*/rules/ Phase 3: Déplacement des diagrammes d'entités vers domains/*/entities/ Phase 4: Déplacement des diagrammes flux/états/séquences vers domains/*/ Phase 5: Création des README.md pour chaque domaine Phase 6: Déplacement des features Gherkin vers domains/*/features/ Phase 7: Création du Context Map (domains/README.md) Phase 8: Mise à jour de mkdocs.yml pour la nouvelle navigation Phase 9: Correction automatique des liens internes (script fix-markdown-links.sh) Phase 10: Nettoyage de l'ancienne structure (regles-metier/, diagrammes/, features/) **Configuration des tests:** - Makefile: godog run docs/domains/*/features/ - scripts/generate-bdd-docs.py: features_dir → docs/domains **Avantages:** ✅ Cohésion forte: toute la doc d'un domaine au même endroit ✅ Couplage faible: domaines indépendants, dépendances explicites ✅ Navigabilité améliorée: README par domaine = entrée claire ✅ Alignement code/docs: miroir de backend/internal/ ✅ Onboarding facilité: exploration domaine par domaine ✅ Tests BDD intégrés: features au plus près des règles métier Voir docs/REFACTOR-DDD.md pour le plan complet.
This commit is contained in:
58
docs/domains/premium/entities/modele-premium.md
Normal file
58
docs/domains/premium/entities/modele-premium.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Modèle de données - Premium
|
||||
|
||||
📖 Voir [Règles métier - Section 17 : Premium](../rules/premium.md) | [Entités globales](../../_shared/entities/modele-global.md)
|
||||
|
||||
## Diagramme
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
PREMIUM_SUBSCRIPTIONS }o--|| USERS : "abonnement"
|
||||
ACTIVE_STREAMS }o--|| USERS : "stream actif"
|
||||
ACTIVE_STREAMS }o--|| CONTENTS : "écoute"
|
||||
|
||||
OFFLINE_DOWNLOADS }o--|| USERS : "téléchargé par"
|
||||
OFFLINE_DOWNLOADS }o--|| CONTENTS : "contenu"
|
||||
|
||||
PREMIUM_SUBSCRIPTIONS {
|
||||
uuid id PK
|
||||
uuid user_id FK UK
|
||||
string provider
|
||||
string provider_subscription_id
|
||||
string provider_user_id
|
||||
string status
|
||||
string plan
|
||||
timestamp current_period_start
|
||||
timestamp current_period_end
|
||||
timestamp cancelled_at
|
||||
timestamp created_at
|
||||
}
|
||||
|
||||
ACTIVE_STREAMS {
|
||||
uuid id PK
|
||||
uuid user_id FK UK
|
||||
uuid content_id FK
|
||||
string device_id
|
||||
string mode
|
||||
int last_position_seconds
|
||||
timestamp started_at
|
||||
timestamp last_heartbeat
|
||||
}
|
||||
|
||||
OFFLINE_DOWNLOADS {
|
||||
uuid id PK
|
||||
uuid user_id FK
|
||||
uuid content_id FK
|
||||
string quality
|
||||
int file_size_bytes
|
||||
timestamp downloaded_at
|
||||
timestamp expires_at
|
||||
}
|
||||
```
|
||||
|
||||
## Légende
|
||||
|
||||
**Entités Premium** :
|
||||
|
||||
- **PREMIUM_SUBSCRIPTIONS** : Abonnements Premium - Provider : `mangopay` (web 4.99€), `apple` (IAP 5.99€), `google` (Play 5.99€) - Status : `active`, `cancelled`, `expired`, `past_due` - Plan : `monthly` (4.99€), `yearly` (49.99€ = 2 mois offerts) - Pas d'essai gratuit - Vérification temps réel via Redis cache (TTL 1h) + webhooks providers
|
||||
- **ACTIVE_STREAMS** : Streams actifs multi-devices - Limite 1 stream actif par compte (dernier device prioritaire KISS) - Mode : `online`, `offline` (si offline + WiFi/4G) - Heartbeat 30s, TTL Redis 5 min - Détection simultanée : WebSocket close device précédent - Exception : offline mode avion (pas de détection possible)
|
||||
- **OFFLINE_DOWNLOADS** : Téléchargements offline - Quality : `low` (24 kbps), `standard` (48 kbps), `high` (64 kbps Premium only) - Limite gratuit : 50 contenus max, Premium : illimité (espace disque) - Validité 30j, renouvellement auto si WiFi - Suppression auto après expiration
|
||||
Reference in New Issue
Block a user