Outils pour utilisateurs

Outils du site


ujusum:3-codage:2-sprints:6-sprint-6

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
ujusum:3-codage:2-sprints:6-sprint-6 [2026/06/10 18:27] 83.202.252.200ujusum:3-codage:2-sprints:6-sprint-6 [2026/06/11 02:07] (Version actuelle) 83.202.252.200
Ligne 2632: Ligne 2632:
  
 Enterprise Asset Management Platform Enterprise Asset Management Platform
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2 — Asset Intelligence & Lifecycle Management ======
 +
 +===== Objectif =====
 +
 +Transformer le registre d'actifs en plateforme patrimoniale Enterprise.
 +
 +Cette couche permet :
 +
 +<code>
 +Valorisation
 +
 +Amortissement
 +
 +Prévision de cycle de vie
 +
 +Planification CAPEX
 +
 +Optimisation maintenance
 +
 +Pilotage patrimonial
 +</code>
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Depreciation Engine
 +
 +✓ Asset Valuation
 +
 +✓ Lifecycle Forecasting
 +
 +✓ Replacement Planning
 +
 +✓ Maintenance Cost Analytics
 +
 +✓ Asset Health Score
 +
 +✓ Asset Intelligence Platform
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Assets
 +
 +
 +
 +Asset Intelligence Engine
 +
 +├── Depreciation Engine
 +├── Asset Valuation
 +├── Lifecycle Forecasting
 +├── Replacement Planning
 +├── Maintenance Analytics
 +├── Asset Health Scoring
 +└── AI Recommendations
 +
 +
 +
 +Portfolio Analytics
 +
 +
 +
 +Capital Planning
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — AssetDepreciation ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model AssetDepreciation {
 +
 +  assetId               String
 +                        @id
 +
 +  acquisitionValue      Decimal
 +                        @db.Decimal(14,2)
 +
 +  residualValue         Decimal
 +                        @db.Decimal(14,2)
 +
 +  usefulLifeYears       Int
 +
 +  annualDepreciation    Decimal
 +                        @db.Decimal(14,2)
 +
 +  accumulatedDepreciation Decimal
 +                        @db.Decimal(14,2)
 +
 +  bookValue             Decimal
 +                        @db.Decimal(14,2)
 +
 +  calculatedAt          DateTime
 +                        @updatedAt
 +
 +  asset                 Asset
 +                        @relation(
 +                          fields:[assetId],
 +                          references:[id],
 +                          onDelete:Cascade
 +                        )
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — AssetValuation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model AssetValuation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  assetId               String
 +
 +  valuationDate         DateTime
 +
 +  estimatedValue        Decimal
 +                        @db.Decimal(14,2)
 +
 +  valuationMethod       AssetValuationMethod
 +
 +  confidenceScore       Float?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  asset                 Asset
 +                        @relation(
 +                          fields:[assetId],
 +                          references:[id],
 +                          onDelete:Cascade
 +                        )
 +
 +  @@index([assetId])
 +
 +  @@index([valuationDate])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — AssetForecast ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model AssetForecast {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  assetId               String
 +
 +  forecastType          AssetForecastType
 +
 +  forecastDate          DateTime
 +
 +  predictedValue        Float
 +
 +  confidenceScore       Float?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([assetId])
 +
 +  @@index([forecastType])
 +
 +  @@index([forecastDate])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — AssetHealthScore ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model AssetHealthScore {
 +
 +  assetId               String
 +                        @id
 +
 +  overallScore          Float
 +
 +  conditionScore        Float
 +
 +  maintenanceScore      Float
 +
 +  utilizationScore      Float
 +
 +  ageScore              Float
 +
 +  riskScore             Float
 +
 +  calculatedAt          DateTime
 +                        @updatedAt
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — AssetRecommendation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model AssetRecommendation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  assetId               String
 +
 +  recommendationType    AssetRecommendationType
 +
 +  priority              RecommendationPriority
 +
 +  title                 String
 +
 +  description           String
 +
 +  estimatedCost         Decimal?
 +                        @db.Decimal(14,2)
 +
 +  estimatedSavings      Decimal?
 +                        @db.Decimal(14,2)
 +
 +  implemented           Boolean
 +                        @default(false)
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([assetId])
 +
 +  @@index([recommendationType])
 +
 +  @@index([priority])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum AssetValuationMethod {
 +
 +  BOOK_VALUE
 +
 +  MARKET_VALUE
 +
 +  REPLACEMENT_COST
 +
 +  AI_ESTIMATION
 +}
 +
 +enum AssetForecastType {
 +
 +  REPLACEMENT
 +
 +  FAILURE_RISK
 +
 +  MAINTENANCE_COST
 +
 +  VALUE_EVOLUTION
 +}
 +
 +enum AssetRecommendationType {
 +
 +  REPAIR
 +
 +  REPLACE
 +
 +  UPGRADE
 +
 +  INSPECT
 +
 +  RETIRE
 +}
 +
 +enum RecommendationPriority {
 +
 +  LOW
 +
 +  MEDIUM
 +
 +  HIGH
 +
 +  CRITICAL
 +}
 +</code>
 +
 +----
 +
 +====== Étape 7 — Migration ======
 +
 +===== Générer =====
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name asset_intelligence
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-B ======
 +
 +===== Asset Intelligence Module =====
 +
 +----
 +
 +====== Étape 8 — Création ======
 +
 +<code>
 +src/modules/asset-intelligence
 +
 +├── depreciation
 +
 +├── valuation
 +
 +├── forecasting
 +
 +├── planning
 +
 +├── health
 +
 +├── recommendations
 +
 +└── asset-intelligence.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 9 — Services ======
 +
 +===== Créer =====
 +
 +<code>
 +DepreciationEngineService
 +
 +AssetValuationService
 +
 +LifecycleForecastService
 +
 +ReplacementPlanningService
 +
 +MaintenanceCostAnalyticsService
 +
 +AssetHealthScoreService
 +
 +AssetRecommendationService
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-C ======
 +
 +===== Depreciation Engine =====
 +
 +----
 +
 +====== Étape 10 — DepreciationEngineService ======
 +
 +===== Créer =====
 +
 +<code>
 +depreciation-engine.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +calculateStraightLine()
 +
 +calculateBookValue()
 +
 +calculateAccumulatedDepreciation()
 +
 +generateDepreciationSchedule()
 +</code>
 +
 +----
 +
 +====== Étape 11 — Méthodes comptables ======
 +
 +===== Supporter =====
 +
 +<code>
 +Linéaire
 +
 +Dégressif
 +
 +Personnalisé
 +</code>
 +
 +----
 +
 +====== Étape 12 — Exemple ======
 +
 +<code>
 +Actif
 +
 +10 000 €
 +
 +Durée
 +
 +5 ans
 +
 +
 +
 +2 000 €/an
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-D ======
 +
 +===== Asset Valuation =====
 +
 +----
 +
 +====== Étape 13 — AssetValuationService ======
 +
 +===== Créer =====
 +
 +<code>
 +asset-valuation.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +estimateCurrentValue()
 +
 +estimateReplacementCost()
 +
 +estimateResidualValue()
 +</code>
 +
 +----
 +
 +====== Étape 14 — Facteurs ======
 +
 +===== Utiliser =====
 +
 +<code>
 +Âge
 +
 +État
 +
 +Maintenance
 +
 +Utilisation
 +
 +Marché
 +</code>
 +
 +----
 +
 +====== Étape 15 — Valorisation ======
 +
 +===== Produire =====
 +
 +<code>
 +Valeur brute
 +
 +Valeur nette
 +
 +Valeur marché
 +
 +Valeur remplacement
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-E ======
 +
 +===== Lifecycle Forecasting =====
 +
 +----
 +
 +====== Étape 16 — LifecycleForecastService ======
 +
 +===== Créer =====
 +
 +<code>
 +lifecycle-forecast.service.ts
 +</code>
 +
 +----
 +
 +===== Prévoir =====
 +
 +<code>
 +Fin de vie
 +
 +Risque panne
 +
 +Coût futur
 +
 +Maintenance future
 +</code>
 +
 +----
 +
 +====== Étape 17 — Méthodes ======
 +
 +<code ts>
 +forecastReplacement()
 +
 +forecastFailureRisk()
 +
 +forecastMaintenanceCost()
 +</code>
 +
 +----
 +
 +====== Étape 18 — Exemple ======
 +
 +<code>
 +Climatisation
 +
 +Fin de vie estimée
 +
 +14 mois
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-F ======
 +
 +===== Replacement Planning =====
 +
 +----
 +
 +====== Étape 19 — ReplacementPlanningService ======
 +
 +===== Créer =====
 +
 +<code>
 +replacement-planning.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +CAPEX Forecast
 +
 +Replacement Calendar
 +
 +Investment Plan
 +</code>
 +
 +----
 +
 +====== Étape 20 — Priorisation ======
 +
 +===== Classer =====
 +
 +selon :
 +
 +<code>
 +Health Score
 +
 +Coût maintenance
 +
 +Criticité
 +
 +ROI remplacement
 +</code>
 +
 +----
 +
 +====== Étape 21 — Exemple ======
 +
 +<code>
 +2028
 +
 +12 climatiseurs
 +
 +
 +
 +CAPEX 42 000 €
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-G ======
 +
 +===== Maintenance Cost Analytics =====
 +
 +----
 +
 +====== Étape 22 — MaintenanceCostAnalyticsService ======
 +
 +===== Créer =====
 +
 +<code>
 +maintenance-cost-analytics.service.ts
 +</code>
 +
 +----
 +
 +===== Analyser =====
 +
 +<code>
 +Coûts maintenance
 +
 +Coût possession
 +
 +Coût panne
 +
 +ROI réparation
 +</code>
 +
 +----
 +
 +====== Étape 23 — Sources ======
 +
 +===== Utiliser =====
 +
 +<code>
 +MaintenanceWorkOrder
 +
 +AssetLifecycle
 +
 +AssetValuation
 +</code>
 +
 +----
 +
 +====== Étape 24 — KPI ======
 +
 +===== Mesurer =====
 +
 +<code>
 +Maintenance Cost Ratio
 +
 +Cost Per Asset
 +
 +Failure Cost
 +
 +Replacement ROI
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-H ======
 +
 +===== Asset Health Score =====
 +
 +----
 +
 +====== Étape 25 — AssetHealthScoreService ======
 +
 +===== Créer =====
 +
 +<code>
 +asset-health-score.service.ts
 +</code>
 +
 +----
 +
 +===== Calcul =====
 +
 +<code>
 +Condition         30%
 +
 +Maintenance       25%
 +
 +Age               20%
 +
 +Utilization       15%
 +
 +Risk              10%
 +</code>
 +
 +----
 +
 +====== Étape 26 — Classification ======
 +
 +<code>
 +90-100 Excellent
 +
 +75-89 Healthy
 +
 +50-74 Warning
 +
 +0-49 Critical
 +</code>
 +
 +----
 +
 +====== Étape 27 — Exemple ======
 +
 +<code>
 +Asset Health
 +
 +92
 +
 +Excellent
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-I ======
 +
 +===== Recommandations IA =====
 +
 +----
 +
 +====== Étape 28 — AssetRecommendationService ======
 +
 +===== Créer =====
 +
 +<code>
 +asset-recommendation.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +Remplacement
 +
 +Réparation
 +
 +Inspection
 +
 +Upgrade
 +
 +Retrait
 +</code>
 +
 +----
 +
 +====== Étape 29 — Exemple ======
 +
 +<code>
 +Climatisation
 +
 +Health Score 41
 +
 +
 +
 +Remplacement recommandé
 +</code>
 +
 +----
 +
 +====== Étape 30 — Exemple ======
 +
 +<code>
 +TV
 +
 +Health Score 82
 +
 +
 +
 +Maintenance préventive
 +</code>
 +
 +----
 +
 +====== Sprint 6-B.2-J ======
 +
 +===== Dashboard Intelligence =====
 +
 +----
 +
 +====== Étape 31 — Endpoints ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /assets/intelligence
 +
 +GET /assets/{id}/health
 +
 +GET /assets/{id}/valuation
 +
 +GET /assets/{id}/forecast
 +
 +GET /assets/recommendations
 +
 +GET /assets/capex-plan
 +</code>
 +
 +----
 +
 +====== Étape 32 — Exemple ======
 +
 +===== Réponse =====
 +
 +<code json>
 +{
 +  "healthScore":92,
 +  "currentValue":8400,
 +  "replacementRisk":"LOW",
 +  "recommendations":[]
 +}
 +</code>
 +
 +----
 +
 +====== Étape 33 — Analytics ======
 +
 +===== Mesurer =====
 +
 +<code>
 +Forecast Accuracy
 +
 +Maintenance Savings
 +
 +Asset Lifespan
 +
 +CAPEX Accuracy
 +
 +Health Score Trends
 +</code>
 +
 +----
 +
 +====== Gouvernance ======
 +
 +----
 +
 +====== Étape 34 — Permissions ======
 +
 +===== Ajouter =====
 +
 +<code>
 +asset.intelligence.read
 +
 +asset.intelligence.forecast
 +
 +asset.intelligence.health
 +
 +asset.intelligence.capex
 +
 +asset.intelligence.admin
 +</code>
 +
 +----
 +
 +====== Étape 35 — Audit ======
 +
 +===== Journaliser =====
 +
 +<code>
 +ASSET_HEALTH_UPDATED
 +
 +ASSET_FORECAST_GENERATED
 +
 +ASSET_VALUATION_UPDATED
 +
 +ASSET_RECOMMENDATION_CREATED
 +
 +CAPEX_PLAN_GENERATED
 +</code>
 +
 +----
 +
 +====== Étape 36 — Jobs ======
 +
 +===== Ajouter =====
 +
 +<code>
 +Toutes les nuits
 +
 +Health Score Refresh
 +
 +Forecast Generation
 +
 +Valuation Refresh
 +
 +Recommendation Generation
 +</code>
 +
 +----
 +
 +====== Clôture Domaine Asset ======
 +
 +À la fin du Sprint 6-B.2 :
 +
 +<code>
 +✓ Asset Registry
 +
 +✓ Asset Tracking
 +
 +✓ Asset Lifecycle
 +
 +✓ Depreciation Engine
 +
 +✓ Asset Valuation
 +
 +✓ Forecasting
 +
 +✓ CAPEX Planning
 +
 +✓ Asset Intelligence
 +</code>
 +
 +sont entièrement opérationnels.
 +
 +----
 +
 +====== Sprint 6-C.1 — Portfolio Analytics & Multi-Site KPIs ======
 +
 +===== Objectif =====
 +
 +Construire le cockpit décisionnel consolidé du parc immobilier.
 +
 +Cette couche permet d'obtenir une vue globale :
 +
 +<code>
 +Portefeuilles
 +
 +Groupes
 +
 +Propriétés
 +
 +Revenus
 +
 +Occupation
 +
 +Performance
 +</code>
 +
 +afin de piloter des dizaines, centaines ou milliers de propriétés depuis une interface unique.
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Portfolio Dashboard
 +
 +✓ Portfolio Revenue
 +
 +✓ Portfolio Occupancy
 +
 +✓ Portfolio Benchmarking
 +
 +✓ Multi-Site KPIs
 +
 +✓ Executive Reporting
 +
 +✓ Enterprise Portfolio Analytics
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Portfolio
 +
 +
 +
 +Portfolio Analytics Engine
 +
 +├── Revenue Analytics
 +├── Occupancy Analytics
 +├── Reservation Analytics
 +├── Property Performance
 +├── Benchmarking
 +├── Executive KPIs
 +└── Reporting
 +
 +
 +
 +Executive Dashboard
 +
 +
 +
 +Portfolio Intelligence
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — PortfolioAnalyticsSnapshot ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model PortfolioAnalyticsSnapshot {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String
 +
 +  snapshotDate          DateTime
 +
 +  propertiesCount       Int
 +                        @default(0)
 +
 +  reservationsCount     Int
 +                        @default(0)
 +
 +  revenue               Decimal
 +                        @db.Decimal(14,2)
 +
 +  occupancyRate         Float?
 +
 +  averageRating         Float?
 +
 +  adr                   Decimal?
 +                        @db.Decimal(14,2)
 +
 +  revPar                Decimal?
 +                        @db.Decimal(14,2)
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([snapshotDate])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — PortfolioKPI ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioKPI {
 +
 +  portfolioId           String
 +                        @id
 +
 +  occupancyRate         Float?
 +
 +  adr                   Float?
 +
 +  revPar                Float?
 +
 +  revenueGrowth         Float?
 +
 +  reservationGrowth     Float?
 +
 +  guestSatisfaction     Float?
 +
 +  updatedAt             DateTime
 +                        @updatedAt
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — PortfolioBenchmark ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioBenchmark {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  portfolioId           String
 +
 +  metric                PortfolioBenchmarkMetric
 +
 +  portfolioValue        Float
 +
 +  benchmarkValue        Float
 +
 +  variancePercent       Float
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([portfolioId])
 +
 +  @@index([metric])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — ExecutiveReport ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model ExecutiveReport {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String?
 +
 +  reportType            ExecutiveReportType
 +
 +  periodStart           DateTime
 +
 +  periodEnd             DateTime
 +
 +  generatedAt           DateTime
 +                        @default(now())
 +
 +  storagePath           String?
 +
 +  createdBy             String?
 +
 +  @@index([tenantId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([reportType])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum PortfolioBenchmarkMetric {
 +
 +  REVENUE
 +
 +  OCCUPANCY
 +
 +  ADR
 +
 +  REVPAR
 +
 +  SATISFACTION
 +
 +  RESERVATIONS
 +}
 +
 +enum ExecutiveReportType {
 +
 +  DAILY
 +
 +  WEEKLY
 +
 +  MONTHLY
 +
 +  QUARTERLY
 +
 +  ANNUAL
 +
 +  CUSTOM
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — Migration ======
 +
 +===== Générer =====
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name portfolio_analytics
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-B ======
 +
 +===== Portfolio Analytics Module =====
 +
 +----
 +
 +====== Étape 7 — Création ======
 +
 +<code>
 +src/modules/portfolio-analytics
 +
 +├── dashboard
 +
 +├── revenue
 +
 +├── occupancy
 +
 +├── benchmarking
 +
 +├── reporting
 +
 +├── kpis
 +
 +└── portfolio-analytics.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 8 — Services ======
 +
 +===== Créer =====
 +
 +<code>
 +PortfolioDashboardService
 +
 +PortfolioRevenueService
 +
 +PortfolioOccupancyService
 +
 +PortfolioBenchmarkingService
 +
 +ExecutiveReportingService
 +
 +PortfolioKPIService
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-C ======
 +
 +===== Revenue Analytics =====
 +
 +----
 +
 +====== Étape 9 — PortfolioRevenueService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-revenue.service.ts
 +</code>
 +
 +----
 +
 +===== Calculer =====
 +
 +<code>
 +Gross Revenue
 +
 +Net Revenue
 +
 +Revenue Growth
 +
 +Revenue By Property
 +
 +Revenue By Group
 +</code>
 +
 +----
 +
 +====== Étape 10 — Sources ======
 +
 +===== Utiliser =====
 +
 +<code>
 +Reservations
 +
 +Invoices
 +
 +Payments
 +
 +Refunds
 +</code>
 +
 +----
 +
 +====== Étape 11 — KPIs ======
 +
 +===== Produire =====
 +
 +<code>
 +ADR
 +
 +RevPAR
 +
 +Revenue Per Property
 +
 +Revenue Per Portfolio
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-D ======
 +
 +===== Occupancy Analytics =====
 +
 +----
 +
 +====== Étape 12 — PortfolioOccupancyService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-occupancy.service.ts
 +</code>
 +
 +----
 +
 +===== Mesurer =====
 +
 +<code>
 +Occupancy Rate
 +
 +Available Nights
 +
 +Booked Nights
 +
 +Lost Nights
 +
 +Capacity Usage
 +</code>
 +
 +----
 +
 +====== Étape 13 — Segmentation ======
 +
 +===== Analyser =====
 +
 +par :
 +
 +<code>
 +Portfolio
 +
 +Property Group
 +
 +Property
 +
 +Region
 +
 +Category
 +</code>
 +
 +----
 +
 +====== Étape 14 — KPIs ======
 +
 +===== Calculer =====
 +
 +<code>
 +Occupancy %
 +
 +Average Stay
 +
 +Booking Window
 +
 +Seasonality
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-E ======
 +
 +===== Multi-Site KPIs =====
 +
 +----
 +
 +====== Étape 15 — PortfolioKPIService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-kpi.service.ts
 +</code>
 +
 +----
 +
 +===== Agréger =====
 +
 +<code>
 +Revenue
 +
 +Occupancy
 +
 +Reservations
 +
 +Reviews
 +
 +Operations
 +
 +Assets
 +</code>
 +
 +----
 +
 +====== Étape 16 — Executive KPIs ======
 +
 +===== Calculer =====
 +
 +<code>
 +ADR
 +
 +RevPAR
 +
 +Occupancy
 +
 +Revenue Growth
 +
 +Guest Satisfaction
 +
 +Asset Utilization
 +</code>
 +
 +----
 +
 +====== Étape 17 — Score Global ======
 +
 +===== Construire =====
 +
 +<code>
 +Portfolio Health Score
 +</code>
 +
 +à partir de :
 +
 +<code>
 +Revenue
 +
 +Occupancy
 +
 +Reviews
 +
 +Operations
 +
 +Assets
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-F ======
 +
 +===== Benchmarking =====
 +
 +----
 +
 +====== Étape 18 — PortfolioBenchmarkingService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-benchmarking.service.ts
 +</code>
 +
 +----
 +
 +===== Comparer =====
 +
 +<code>
 +Portfolios
 +
 +Property Groups
 +
 +Properties
 +</code>
 +
 +----
 +
 +====== Étape 19 — Classements ======
 +
 +===== Identifier =====
 +
 +<code>
 +Top Revenue
 +
 +Top Occupancy
 +
 +Top Reviews
 +
 +Top Growth
 +</code>
 +
 +----
 +
 +====== Étape 20 — Variances ======
 +
 +===== Calculer =====
 +
 +<code>
 +Portfolio
 +
 +vs
 +
 +Average Portfolio
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-G ======
 +
 +===== Executive Reporting =====
 +
 +----
 +
 +====== Étape 21 — ExecutiveReportingService ======
 +
 +===== Créer =====
 +
 +<code>
 +executive-reporting.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +Daily Report
 +
 +Weekly Report
 +
 +Monthly Report
 +
 +Board Report
 +</code>
 +
 +----
 +
 +====== Étape 22 — Formats ======
 +
 +===== Supporter =====
 +
 +<code>
 +PDF
 +
 +Excel
 +
 +CSV
 +</code>
 +
 +----
 +
 +====== Étape 23 — Contenu ======
 +
 +===== Inclure =====
 +
 +<code>
 +Revenue
 +
 +Occupancy
 +
 +Reservations
 +
 +Incidents
 +
 +Assets
 +
 +Forecasts
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-H ======
 +
 +===== Portfolio Dashboard =====
 +
 +----
 +
 +====== Étape 24 — PortfolioDashboardService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-dashboard.service.ts
 +</code>
 +
 +----
 +
 +===== Agréger =====
 +
 +<code>
 +Revenue
 +
 +Occupancy
 +
 +Reservations
 +
 +Properties
 +
 +Reviews
 +
 +Assets
 +</code>
 +
 +----
 +
 +====== Étape 25 — Endpoint ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /portfolio/dashboard
 +
 +GET /portfolio/{id}/dashboard
 +</code>
 +
 +----
 +
 +====== Étape 26 — Exemple ======
 +
 +===== Réponse =====
 +
 +<code json>
 +{
 +  "properties":245,
 +  "occupancy":82.4,
 +  "revenue":8450000,
 +  "adr":142,
 +  "revpar":117,
 +  "portfolioHealth":91
 +}
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-I ======
 +
 +===== API Analytics =====
 +
 +----
 +
 +====== Étape 27 — Endpoints ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /portfolio/analytics/revenue
 +
 +GET /portfolio/analytics/occupancy
 +
 +GET /portfolio/analytics/kpis
 +
 +GET /portfolio/analytics/benchmark
 +
 +GET /portfolio/reports
 +
 +POST /portfolio/reports
 +</code>
 +
 +----
 +
 +====== Étape 28 — Filtres ======
 +
 +===== Supporter =====
 +
 +<code>
 +Portfolio
 +
 +Property Group
 +
 +Property
 +
 +Date Range
 +
 +Region
 +
 +Category
 +</code>
 +
 +----
 +
 +====== Étape 29 — Export ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /portfolio/reports/{id}/download
 +</code>
 +
 +Formats :
 +
 +<code>
 +PDF
 +
 +Excel
 +
 +CSV
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.1-J ======
 +
 +===== Gouvernance =====
 +
 +----
 +
 +====== Étape 30 — Permissions ======
 +
 +===== Ajouter =====
 +
 +<code>
 +portfolio.analytics.read
 +
 +portfolio.analytics.export
 +
 +portfolio.analytics.benchmark
 +
 +portfolio.analytics.executive
 +
 +portfolio.analytics.admin
 +</code>
 +
 +----
 +
 +====== Étape 31 — Audit ======
 +
 +===== Journaliser =====
 +
 +<code>
 +PORTFOLIO_DASHBOARD_VIEWED
 +
 +PORTFOLIO_KPI_CALCULATED
 +
 +BENCHMARK_GENERATED
 +
 +EXECUTIVE_REPORT_CREATED
 +
 +REPORT_DOWNLOADED
 +</code>
 +
 +----
 +
 +====== Étape 32 — Jobs ======
 +
 +===== Ajouter =====
 +
 +<code>
 +Toutes les heures
 +
 +Portfolio KPI Refresh
 +
 +Toutes les nuits
 +
 +Analytics Snapshot
 +
 +Benchmark Refresh
 +
 +Executive Report Generation
 +</code>
 +
 +----
 +
 +====== Préparation Sprint 6-C.2 ======
 +
 +Compatible avec :
 +
 +<code>
 +Forecasting
 +
 +Portfolio Intelligence
 +
 +Executive AI
 +
 +Investment Planning
 +</code>
 +
 +----
 +
 +====== Définition de terminé ======
 +
 +Le Sprint 6-C.1 est terminé lorsque :
 +
 +<code>
 +✓ Portfolio Dashboard créé
 +
 +✓ Revenue Analytics créé
 +
 +✓ Occupancy Analytics créé
 +
 +✓ Benchmarking créé
 +
 +✓ Executive Reporting créé
 +
 +✓ Multi-Site KPIs créés
 +
 +✓ Audit intégré
 +</code>
 +
 +----
 +
 +====== Livrables ======
 +
 +<code>
 +PortfolioAnalyticsSnapshot
 +
 +PortfolioKPI
 +
 +PortfolioBenchmark
 +
 +ExecutiveReport
 +
 +PortfolioDashboardService
 +
 +PortfolioRevenueService
 +
 +PortfolioOccupancyService
 +
 +PortfolioBenchmarkingService
 +
 +ExecutiveReportingService
 +
 +Portfolio Analytics Platform
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2 — Portfolio Intelligence & Prévisions Multi-Sites ======
 +
 +===== Objectif =====
 +
 +Transformer les analytics consolidés en plateforme décisionnelle prédictive Enterprise.
 +
 +Cette couche permet :
 +
 +<code>
 +Prévisions
 +
 +Planification stratégique
 +
 +Détection d'opportunités
 +
 +Prévisions revenus
 +
 +Prévisions occupation
 +
 +Pilotage d'investissement
 +</code>
 +
 +sur l'ensemble du portefeuille immobilier.
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Portfolio Forecasting
 +
 +✓ Revenue Forecast
 +
 +✓ Occupancy Forecast
 +
 +✓ Investment Insights
 +
 +✓ Portfolio Health Score
 +
 +✓ Executive AI Insights
 +
 +✓ Portfolio Intelligence Platform
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Portfolio Analytics
 +
 +
 +
 +Portfolio Intelligence Engine
 +
 +├── Revenue Forecast
 +├── Occupancy Forecast
 +├── Investment Insights
 +├── Risk Analysis
 +├── Portfolio Health Score
 +├── Executive AI Insights
 +└── Strategic Recommendations
 +
 +
 +
 +Executive Management
 +
 +
 +
 +Investment Planning
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — PortfolioForecast ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model PortfolioForecast {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String
 +
 +  forecastType          PortfolioForecastType
 +
 +  forecastDate          DateTime
 +
 +  predictedValue        Float
 +
 +  confidenceScore       Float?
 +
 +  generatedAt           DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([forecastType])
 +
 +  @@index([forecastDate])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — PortfolioInsight ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioInsight {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String?
 +
 +  category              PortfolioInsightCategory
 +
 +  severity              InsightSeverity
 +
 +  title                 String
 +
 +  description           String
 +
 +  recommendation        String?
 +
 +  impactScore           Float?
 +
 +  implemented           Boolean
 +                        @default(false)
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([category])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — PortfolioHealthScore ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioHealthScore {
 +
 +  portfolioId           String
 +                        @id
 +
 +  overallScore          Float
 +
 +  revenueScore          Float
 +
 +  occupancyScore        Float
 +
 +  guestScore            Float
 +
 +  operationsScore       Float
 +
 +  assetScore            Float
 +
 +  growthScore           Float
 +
 +  calculatedAt          DateTime
 +                        @updatedAt
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — InvestmentRecommendation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model InvestmentRecommendation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  portfolioId           String
 +
 +  recommendationType    InvestmentRecommendationType
 +
 +  priority              RecommendationPriority
 +
 +  title                 String
 +
 +  description           String
 +
 +  estimatedInvestment   Decimal?
 +                        @db.Decimal(14,2)
 +
 +  estimatedReturn       Decimal?
 +                        @db.Decimal(14,2)
 +
 +  roiPercent            Float?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([portfolioId])
 +
 +  @@index([recommendationType])
 +
 +  @@index([priority])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum PortfolioForecastType {
 +
 +  REVENUE
 +
 +  OCCUPANCY
 +
 +  RESERVATIONS
 +
 +  REVPAR
 +
 +  ADR
 +}
 +
 +enum PortfolioInsightCategory {
 +
 +  REVENUE
 +
 +  OCCUPANCY
 +
 +  OPERATIONS
 +
 +  ASSETS
 +
 +  INVESTMENT
 +
 +  GROWTH
 +}
 +
 +enum InvestmentRecommendationType {
 +
 +  ACQUISITION
 +
 +  RENOVATION
 +
 +  REPLACEMENT
 +
 +  EXPANSION
 +
 +  OPTIMIZATION
 +
 +  DIVESTMENT
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — Migration ======
 +
 +===== Générer =====
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name portfolio_intelligence
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-B ======
 +
 +===== Portfolio Intelligence Module =====
 +
 +----
 +
 +====== Étape 7 — Création ======
 +
 +<code>
 +src/modules/portfolio-intelligence
 +
 +├── forecasts
 +
 +├── revenue
 +
 +├── occupancy
 +
 +├── investments
 +
 +├── health
 +
 +├── insights
 +
 +└── portfolio-intelligence.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 8 — Services ======
 +
 +===== Créer =====
 +
 +<code>
 +PortfolioForecastService
 +
 +RevenueForecastService
 +
 +OccupancyForecastService
 +
 +InvestmentInsightService
 +
 +PortfolioHealthScoreService
 +
 +ExecutiveInsightService
 +
 +InvestmentRecommendationService
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-C ======
 +
 +===== Revenue Forecast =====
 +
 +----
 +
 +====== Étape 9 — RevenueForecastService ======
 +
 +===== Créer =====
 +
 +<code>
 +revenue-forecast.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +forecastRevenue()
 +
 +forecastADR()
 +
 +forecastRevPAR()
 +
 +forecastGrowth()
 +</code>
 +
 +----
 +
 +====== Étape 10 — Sources ======
 +
 +===== Utiliser =====
 +
 +<code>
 +Reservations
 +
 +Payments
 +
 +Invoices
 +
 +Portfolio Analytics
 +
 +Seasonality
 +</code>
 +
 +----
 +
 +====== Étape 11 — Prévisions ======
 +
 +===== Produire =====
 +
 +<code>
 +30 jours
 +
 +90 jours
 +
 +12 mois
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-D ======
 +
 +===== Occupancy Forecast =====
 +
 +----
 +
 +====== Étape 12 — OccupancyForecastService ======
 +
 +===== Créer =====
 +
 +<code>
 +occupancy-forecast.service.ts
 +</code>
 +
 +----
 +
 +===== Prévoir =====
 +
 +<code>
 +Occupancy
 +
 +Available Nights
 +
 +Demand
 +
 +Booking Pace
 +</code>
 +
 +----
 +
 +====== Étape 13 — Méthodes ======
 +
 +<code ts>
 +forecastOccupancy()
 +
 +forecastDemand()
 +
 +forecastSeasonality()
 +</code>
 +
 +----
 +
 +====== Étape 14 — Segmentation ======
 +
 +===== Calculer =====
 +
 +par :
 +
 +<code>
 +Portfolio
 +
 +Property Group
 +
 +Property
 +
 +Region
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-E ======
 +
 +===== Investment Insights =====
 +
 +----
 +
 +====== Étape 15 — InvestmentInsightService ======
 +
 +===== Créer =====
 +
 +<code>
 +investment-insight.service.ts
 +</code>
 +
 +----
 +
 +===== Identifier =====
 +
 +<code>
 +Expansion
 +
 +Renovation
 +
 +Asset Replacement
 +
 +Optimization
 +
 +Divestment
 +</code>
 +
 +----
 +
 +====== Étape 16 — Analyse ======
 +
 +===== Utiliser =====
 +
 +<code>
 +Revenue
 +
 +Occupancy
 +
 +Assets
 +
 +Maintenance
 +
 +Guest Satisfaction
 +</code>
 +
 +----
 +
 +====== Étape 17 — Exemple ======
 +
 +<code>
 +Property Group Paris
 +
 +ROI potentiel
 +
 +18%
 +
 +
 +
 +Rénovation recommandée
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-F ======
 +
 +===== Portfolio Health Score =====
 +
 +----
 +
 +====== Étape 18 — PortfolioHealthScoreService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-health-score.service.ts
 +</code>
 +
 +----
 +
 +===== Calcul =====
 +
 +<code>
 +Revenue           25%
 +
 +Occupancy         20%
 +
 +Guest Score       15%
 +
 +Operations        15%
 +
 +Assets            15%
 +
 +Growth            10%
 +</code>
 +
 +----
 +
 +====== Étape 19 — Classification ======
 +
 +<code>
 +90-100 Excellent
 +
 +75-89 Healthy
 +
 +50-74 Warning
 +
 +0-49 Critical
 +</code>
 +
 +----
 +
 +====== Étape 20 — Exemple ======
 +
 +<code>
 +Portfolio Health
 +
 +93
 +
 +Excellent
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-G ======
 +
 +===== Executive AI Insights =====
 +
 +----
 +
 +====== Étape 21 — ExecutiveInsightService ======
 +
 +===== Créer =====
 +
 +<code>
 +executive-insight.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +Revenue Opportunities
 +
 +Occupancy Risks
 +
 +Growth Opportunities
 +
 +Asset Risks
 +
 +Investment Priorities
 +</code>
 +
 +----
 +
 +====== Étape 22 — Exemple ======
 +
 +<code>
 +Les propriétés côtières
 +
 +↑ 22%
 +
 +prévision revenus été
 +
 +
 +
 +Renforcer l'inventaire
 +</code>
 +
 +----
 +
 +====== Étape 23 — Exemple ======
 +
 +<code>
 +Le groupe Europe Nord
 +
 +
 +
 +Occupation en baisse
 +
 +-7%
 +
 +
 +
 +Action recommandée
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-H ======
 +
 +===== Recommandations d'Investissement =====
 +
 +----
 +
 +====== Étape 24 — InvestmentRecommendationService ======
 +
 +===== Créer =====
 +
 +<code>
 +investment-recommendation.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +CAPEX
 +
 +Expansion
 +
 +Acquisition
 +
 +Renovation
 +
 +Cession
 +</code>
 +
 +----
 +
 +====== Étape 25 — Priorisation ======
 +
 +===== Utiliser =====
 +
 +<code>
 +ROI
 +
 +Health Score
 +
 +Forecast
 +
 +Asset Age
 +
 +Revenue Potential
 +</code>
 +
 +----
 +
 +====== Étape 26 — Exemple ======
 +
 +<code>
 +CAPEX
 +
 +250 000 €
 +
 +ROI estimé
 +
 +31%
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-I ======
 +
 +===== Dashboard Intelligence =====
 +
 +----
 +
 +====== Étape 27 — Endpoints ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /portfolio/intelligence
 +
 +GET /portfolio/forecasts
 +
 +GET /portfolio/insights
 +
 +GET /portfolio/health
 +
 +GET /portfolio/investments
 +
 +GET /portfolio/recommendations
 +</code>
 +
 +----
 +
 +====== Étape 28 — Exemple ======
 +
 +===== Réponse =====
 +
 +<code json>
 +{
 +  "revenueForecast":12450000,
 +  "occupancyForecast":84.2,
 +  "portfolioHealth":93,
 +  "investmentOpportunities":12
 +}
 +</code>
 +
 +----
 +
 +====== Étape 29 — Analytics IA ======
 +
 +===== Mesurer =====
 +
 +<code>
 +Forecast Accuracy
 +
 +Investment ROI
 +
 +Health Score Trend
 +
 +Revenue Prediction Accuracy
 +
 +Recommendation Adoption
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-J ======
 +
 +===== Gouvernance =====
 +
 +----
 +
 +====== Étape 30 — Permissions ======
 +
 +===== Ajouter =====
 +
 +<code>
 +portfolio.intelligence.read
 +
 +portfolio.intelligence.forecast
 +
 +portfolio.intelligence.investment
 +
 +portfolio.intelligence.health
 +
 +portfolio.intelligence.executive
 +</code>
 +
 +----
 +
 +====== Étape 31 — Audit ======
 +
 +===== Journaliser =====
 +
 +<code>
 +PORTFOLIO_FORECAST_GENERATED
 +
 +PORTFOLIO_HEALTH_UPDATED
 +
 +EXECUTIVE_INSIGHT_CREATED
 +
 +INVESTMENT_RECOMMENDATION_CREATED
 +
 +INTELLIGENCE_DASHBOARD_VIEWED
 +</code>
 +
 +----
 +
 +====== Étape 32 — Jobs ======
 +
 +===== Ajouter =====
 +
 +<code>
 +Toutes les nuits
 +
 +Portfolio Forecast Refresh
 +
 +Portfolio Health Refresh
 +
 +Executive Insights Generation
 +
 +Investment Recommendation Refresh
 +</code>
 +
 +----
 +
 +====== Clôture Domaine Analytics ======
 +
 +À la fin du Sprint 6-C.2 :
 +
 +<code>
 +✓ Portfolio Analytics
 +
 +✓ Benchmarking
 +
 +✓ Forecasting
 +
 +✓ Executive Reporting
 +
 +✓ Portfolio Health Score
 +
 +✓ Investment Intelligence
 +
 +✓ Executive AI Insights
 +</code>
 +
 +sont entièrement opérationnels.
 +
 +----
 +
 +====== Préparation Sprint 6-D ======
 +
 +Compatible avec :
 +
 +<code>
 +Governance
 +
 +Delegation
 +
 +Approvals
 +
 +Compliance
 +
 +Enterprise Controls
 +</code>
 +
 +----
 +
 +====== Définition de terminé ======
 +
 +Le Sprint 6-C.2 est terminé lorsque :
 +
 +<code>
 +✓ Portfolio Forecasting créé
 +
 +✓ Revenue Forecast créé
 +
 +✓ Occupancy Forecast créé
 +
 +✓ Investment Insights créés
 +
 +✓ Portfolio Health Score créé
 +
 +✓ Executive AI Insights créés
 +
 +✓ Audit intégré
 +</code>
 +
 +----
 +
 +====== Livrables ======
 +
 +<code>
 +PortfolioForecast
 +
 +PortfolioInsight
 +
 +PortfolioHealthScore
 +
 +InvestmentRecommendation
 +
 +PortfolioForecastService
 +
 +RevenueForecastService
 +
 +OccupancyForecastService
 +
 +InvestmentInsightService
 +
 +PortfolioHealthScoreService
 +
 +ExecutiveInsightService
 +
 +InvestmentRecommendationService
 +
 +Portfolio Intelligence Platform
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1 — Enterprise Governance & Multi-Site Security ======
 +
 +===== Objectif =====
 +
 +Mettre en place la couche de gouvernance Enterprise du parc immobilier.
 +
 +Cette couche permet de contrôler :
 +
 +<code>
 +Accès
 +
 +Délégations
 +
 +Validations
 +
 +Conformité
 +
 +Séparation des responsabilités
 +
 +Traçabilité
 +</code>
 +
 +sur l'ensemble des portefeuilles, groupes et propriétés.
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Portfolio RBAC
 +
 +✓ Delegation
 +
 +✓ Approval Workflow
 +
 +✓ Compliance Controls
 +
 +✓ Multi-Site Permissions
 +
 +✓ Governance Dashboard
 +
 +✓ Enterprise Governance Platform
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Tenant
 +
 +
 +
 +Governance Layer
 +
 +├── RBAC
 +├── Delegation
 +├── Approval Workflow
 +├── Compliance
 +├── Audit
 +└── Governance Dashboard
 +
 +
 +
 +Portfolio
 +
 +
 +
 +Property Groups
 +
 +
 +
 +Properties
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — PortfolioRole ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model PortfolioRole {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  name                  String
 +
 +  code                  String
 +
 +  description           String?
 +
 +  systemRole            Boolean
 +                        @default(false)
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  updatedAt             DateTime
 +                        @updatedAt
 +
 +  permissions           PortfolioPermission[]
 +
 +  assignments           PortfolioRoleAssignment[]
 +
 +  @@unique([tenantId, code])
 +
 +  @@index([tenantId])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — PortfolioPermission ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioPermission {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  roleId                String
 +
 +  permission            String
 +
 +  role                  PortfolioRole
 +                        @relation(
 +                          fields:[roleId],
 +                          references:[id],
 +                          onDelete:Cascade
 +                        )
 +
 +  @@index([roleId])
 +
 +  @@index([permission])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — PortfolioRoleAssignment ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioRoleAssignment {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  userId                String
 +
 +  roleId                String
 +
 +  portfolioId           String?
 +
 +  propertyGroupId       String?
 +
 +  propertyId            String?
 +
 +  assignedAt            DateTime
 +                        @default(now())
 +
 +  expiresAt             DateTime?
 +
 +  role                  PortfolioRole
 +                        @relation(
 +                          fields:[roleId],
 +                          references:[id]
 +                        )
 +
 +  @@index([tenantId])
 +
 +  @@index([userId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([propertyId])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — Delegation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model Delegation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  delegatorUserId       String
 +
 +  delegateUserId        String
 +
 +  portfolioId           String?
 +
 +  propertyGroupId       String?
 +
 +  propertyId            String?
 +
 +  startDate             DateTime
 +
 +  endDate               DateTime
 +
 +  active                Boolean
 +                        @default(true)
 +
 +  reason                String?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([delegatorUserId])
 +
 +  @@index([delegateUserId])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — ApprovalRequest ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model ApprovalRequest {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  approvalType          ApprovalType
 +
 +  status                ApprovalStatus
 +
 +  entityType            String
 +
 +  entityId              String
 +
 +  requestedBy           String
 +
 +  approvedBy            String?
 +
 +  requestedAt           DateTime
 +                        @default(now())
 +
 +  approvedAt            DateTime?
 +
 +  comment               String?
 +
 +  @@index([tenantId])
 +
 +  @@index([status])
 +
 +  @@index([approvalType])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — ComplianceControl ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model ComplianceControl {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  code                  String
 +
 +  title                 String
 +
 +  category              ComplianceCategory
 +
 +  enabled               Boolean
 +                        @default(true)
 +
 +  severity              ComplianceSeverity
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([category])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 7 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum ApprovalType {
 +
 +  PROPERTY_CREATION
 +
 +  PROPERTY_UPDATE
 +
 +  OWNER_ASSIGNMENT
 +
 +  OPERATOR_ASSIGNMENT
 +
 +  CAPEX_REQUEST
 +
 +  CONTRACT_APPROVAL
 +}
 +
 +enum ApprovalStatus {
 +
 +  PENDING
 +
 +  APPROVED
 +
 +  REJECTED
 +
 +  CANCELLED
 +}
 +
 +enum ComplianceCategory {
 +
 +  SECURITY
 +
 +  FINANCIAL
 +
 +  LEGAL
 +
 +  GDPR
 +
 +  OPERATIONS
 +}
 +
 +enum ComplianceSeverity {
 +
 +  LOW
 +
 +  MEDIUM
 +
 +  HIGH
 +
 +  CRITICAL
 +}
 +</code>
 +
 +----
 +
 +====== Étape 8 — Migration ======
 +
 +===== Générer =====
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name governance_core
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-B ======
 +
 +===== Governance Module =====
 +
 +----
 +
 +====== Étape 9 — Création ======
 +
 +<code>
 +src/modules/governance
 +
 +├── roles
 +
 +├── permissions
 +
 +├── delegations
 +
 +├── approvals
 +
 +├── compliance
 +
 +├── dashboard
 +
 +└── governance.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 10 — Services ======
 +
 +===== Créer =====
 +
 +<code>
 +PortfolioRBACService
 +
 +DelegationService
 +
 +ApprovalWorkflowService
 +
 +ComplianceControlService
 +
 +GovernanceDashboardService
 +
 +PermissionResolverService
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-C ======
 +
 +===== Portfolio RBAC =====
 +
 +----
 +
 +====== Étape 11 — PortfolioRBACService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-rbac.service.ts
 +</code>
 +
 +----
 +
 +===== Rôles système =====
 +
 +<code>
 +PORTFOLIO_ADMIN
 +
 +PORTFOLIO_MANAGER
 +
 +GROUP_MANAGER
 +
 +PROPERTY_MANAGER
 +
 +OWNER_VIEWER
 +
 +AUDITOR
 +</code>
 +
 +----
 +
 +====== Étape 12 — Permissions ======
 +
 +===== Supporter =====
 +
 +<code>
 +Read
 +
 +Create
 +
 +Update
 +
 +Delete
 +
 +Approve
 +
 +Export
 +
 +Admin
 +</code>
 +
 +par scope.
 +
 +----
 +
 +====== Étape 13 — Scopes ======
 +
 +===== Appliquer =====
 +
 +<code>
 +Portfolio
 +
 +Property Group
 +
 +Property
 +</code>
 +
 +sur chaque permission.
 +
 +----
 +
 +====== Sprint 6-D.1-D ======
 +
 +===== Délégations =====
 +
 +----
 +
 +====== Étape 14 — DelegationService ======
 +
 +===== Créer =====
 +
 +<code>
 +delegation.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +createDelegation()
 +
 +revokeDelegation()
 +
 +validateDelegation()
 +
 +getActiveDelegations()
 +</code>
 +
 +----
 +
 +====== Étape 15 — Cas d'usage ======
 +
 +===== Supporter =====
 +
 +<code>
 +Congés
 +
 +Remplacement
 +
 +Mission temporaire
 +
 +Support régional
 +</code>
 +
 +----
 +
 +====== Étape 16 — Expiration ======
 +
 +===== Désactiver =====
 +
 +automatiquement à :
 +
 +<code>
 +endDate
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-E ======
 +
 +===== Workflow d'Approbation =====
 +
 +----
 +
 +====== Étape 17 — ApprovalWorkflowService ======
 +
 +===== Créer =====
 +
 +<code>
 +approval-workflow.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +submitApproval()
 +
 +approve()
 +
 +reject()
 +
 +cancelApproval()
 +</code>
 +
 +----
 +
 +====== Étape 18 — Workflows ======
 +
 +===== Supporter =====
 +
 +<code>
 +Nouvelle propriété
 +
 +Changement propriétaire
 +
 +CAPEX
 +
 +Contrat
 +
 +Suppression actif
 +</code>
 +
 +----
 +
 +====== Étape 19 — Validation ======
 +
 +===== Exiger =====
 +
 +un approbateur différent du demandeur.
 +
 +----
 +
 +====== Sprint 6-D.1-F ======
 +
 +===== Contrôles de Conformité =====
 +
 +----
 +
 +====== Étape 20 — ComplianceControlService ======
 +
 +===== Créer =====
 +
 +<code>
 +compliance-control.service.ts
 +</code>
 +
 +----
 +
 +===== Vérifier =====
 +
 +<code>
 +RGPD
 +
 +Audit
 +
 +Sécurité
 +
 +Finance
 +
 +Exploitation
 +</code>
 +
 +----
 +
 +====== Étape 21 — Méthodes ======
 +
 +<code ts>
 +runControls()
 +
 +evaluateCompliance()
 +
 +createViolation()
 +
 +closeViolation()
 +</code>
 +
 +----
 +
 +====== Étape 22 — Scores ======
 +
 +===== Calculer =====
 +
 +<code>
 +Compliance Score
 +
 +Risk Score
 +
 +Violation Rate
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-G ======
 +
 +===== Dashboard Gouvernance =====
 +
 +----
 +
 +====== Étape 23 — GovernanceDashboardService ======
 +
 +===== Créer =====
 +
 +<code>
 +governance-dashboard.service.ts
 +</code>
 +
 +----
 +
 +===== Afficher =====
 +
 +<code>
 +Approvals Pending
 +
 +Active Delegations
 +
 +Compliance Score
 +
 +Open Violations
 +
 +Audit Events
 +</code>
 +
 +----
 +
 +====== Étape 24 — KPI ======
 +
 +===== Mesurer =====
 +
 +<code>
 +Approval Time
 +
 +Compliance Rate
 +
 +Policy Violations
 +
 +Delegation Usage
 +
 +Audit Coverage
 +</code>
 +
 +----
 +
 +====== Étape 25 — Endpoint ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /governance/dashboard
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-H ======
 +
 +===== API Gouvernance =====
 +
 +----
 +
 +====== Étape 26 — Endpoints ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET    /governance/roles
 +
 +POST   /governance/roles
 +
 +GET    /governance/delegations
 +
 +POST   /governance/delegations
 +
 +GET    /governance/approvals
 +
 +POST   /governance/approvals
 +
 +POST   /governance/approvals/{id}/approve
 +
 +POST   /governance/approvals/{id}/reject
 +
 +GET    /governance/compliance
 +</code>
 +
 +----
 +
 +====== Étape 27 — Exemple ======
 +
 +===== Approbation =====
 +
 +<code json>
 +{
 +  "approvalType":"CAPEX_REQUEST",
 +  "entityType":"Asset",
 +  "entityId":"ast_123"
 +}
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-I ======
 +
 +===== Sécurité Enterprise =====
 +
 +----
 +
 +====== Étape 28 — Permission Resolver ======
 +
 +===== Créer =====
 +
 +<code>
 +permission-resolver.service.ts
 +</code>
 +
 +----
 +
 +===== Résoudre =====
 +
 +dans l'ordre :
 +
 +<code>
 +Role
 +
 +
 +
 +Delegation
 +
 +
 +
 +Portfolio Scope
 +
 +
 +
 +Property Scope
 +</code>
 +
 +----
 +
 +====== Étape 29 — Middleware ======
 +
 +===== Ajouter =====
 +
 +<code ts>
 +@RequirePortfolioPermission()
 +
 +@RequireApproval()
 +</code>
 +
 +----
 +
 +====== Étape 30 — Audit ======
 +
 +===== Journaliser =====
 +
 +<code>
 +ROLE_ASSIGNED
 +
 +DELEGATION_CREATED
 +
 +APPROVAL_SUBMITTED
 +
 +APPROVAL_APPROVED
 +
 +COMPLIANCE_CHECK_EXECUTED
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-J ======
 +
 +===== Gouvernance Continue =====
 +
 +----
 +
 +====== Étape 31 — Jobs ======
 +
 +===== Ajouter =====
 +
 +<code>
 +Toutes les heures
 +
 +Delegation Expiration
 +
 +Toutes les nuits
 +
 +Compliance Scan
 +
 +Approval Escalation
 +
 +Governance KPI Refresh
 +</code>
 +
 +----
 +
 +====== Étape 32 — Permissions ======
 +
 +===== Ajouter =====
 +
 +<code>
 +governance.read
 +
 +governance.manage
 +
 +governance.approve
 +
 +governance.compliance
 +
 +governance.audit
 +
 +governance.admin
 +</code>
 +
 +----
 +
 +====== Préparation Sprint 6-D.2 ======
 +
 +Compatible avec :
 +
 +<code>
 +Enterprise Policies
 +
 +Risk Management
 +
 +Internal Controls
 +
 +Governance Intelligence
 +
 +Audit Automation
 +</code>
 +
 +----
 +
 +====== Définition de terminé ======
 +
 +Le Sprint 6-D.1 est terminé lorsque :
 +
 +<code>
 +✓ Portfolio RBAC créé
 +
 +✓ Delegation créée
 +
 +✓ Approval Workflow créé
 +
 +✓ Compliance Controls créés
 +
 +✓ Multi-Site Permissions créées
 +
 +✓ Governance Dashboard créé
 +
 +✓ Audit intégré
 +</code>
 +
 +----
 +
 +====== Livrables ======
 +
 +<code>
 +PortfolioRole
 +
 +PortfolioPermission
 +
 +PortfolioRoleAssignment
 +
 +Delegation
 +
 +ApprovalRequest
 +
 +ComplianceControl
 +
 +PortfolioRBACService
 +
 +DelegationService
 +
 +ApprovalWorkflowService
 +
 +ComplianceControlService
 +
 +GovernanceDashboardService
 +
 +Enterprise Governance Platform
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2 — Portfolio Intelligence & Prévisions Multi-Sites ======
 +
 +===== Objectif =====
 +
 +Transformer les analytics consolidés en plateforme décisionnelle prédictive Enterprise.
 +
 +Cette couche permet :
 +
 +<code>
 +Prévisions
 +
 +Planification stratégique
 +
 +Détection d'opportunités
 +
 +Prévisions revenus
 +
 +Prévisions occupation
 +
 +Pilotage d'investissement
 +</code>
 +
 +sur l'ensemble du portefeuille immobilier.
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Portfolio Forecasting
 +
 +✓ Revenue Forecast
 +
 +✓ Occupancy Forecast
 +
 +✓ Investment Insights
 +
 +✓ Portfolio Health Score
 +
 +✓ Executive AI Insights
 +
 +✓ Portfolio Intelligence Platform
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Portfolio Analytics
 +
 +
 +
 +Portfolio Intelligence Engine
 +
 +├── Revenue Forecast
 +├── Occupancy Forecast
 +├── Investment Insights
 +├── Risk Analysis
 +├── Portfolio Health Score
 +├── Executive AI Insights
 +└── Strategic Recommendations
 +
 +
 +
 +Executive Management
 +
 +
 +
 +Investment Planning
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — PortfolioForecast ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model PortfolioForecast {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String
 +
 +  forecastType          PortfolioForecastType
 +
 +  forecastDate          DateTime
 +
 +  predictedValue        Float
 +
 +  confidenceScore       Float?
 +
 +  generatedAt           DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([forecastType])
 +
 +  @@index([forecastDate])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — PortfolioInsight ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioInsight {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String?
 +
 +  category              PortfolioInsightCategory
 +
 +  severity              InsightSeverity
 +
 +  title                 String
 +
 +  description           String
 +
 +  recommendation        String?
 +
 +  impactScore           Float?
 +
 +  implemented           Boolean
 +                        @default(false)
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([category])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — PortfolioHealthScore ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioHealthScore {
 +
 +  portfolioId           String
 +                        @id
 +
 +  overallScore          Float
 +
 +  revenueScore          Float
 +
 +  occupancyScore        Float
 +
 +  guestScore            Float
 +
 +  operationsScore       Float
 +
 +  assetScore            Float
 +
 +  growthScore           Float
 +
 +  calculatedAt          DateTime
 +                        @updatedAt
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — InvestmentRecommendation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model InvestmentRecommendation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  portfolioId           String
 +
 +  recommendationType    InvestmentRecommendationType
 +
 +  priority              RecommendationPriority
 +
 +  title                 String
 +
 +  description           String
 +
 +  estimatedInvestment   Decimal?
 +                        @db.Decimal(14,2)
 +
 +  estimatedReturn       Decimal?
 +                        @db.Decimal(14,2)
 +
 +  roiPercent            Float?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([portfolioId])
 +
 +  @@index([recommendationType])
 +
 +  @@index([priority])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum PortfolioForecastType {
 +
 +  REVENUE
 +
 +  OCCUPANCY
 +
 +  RESERVATIONS
 +
 +  REVPAR
 +
 +  ADR
 +}
 +
 +enum PortfolioInsightCategory {
 +
 +  REVENUE
 +
 +  OCCUPANCY
 +
 +  OPERATIONS
 +
 +  ASSETS
 +
 +  INVESTMENT
 +
 +  GROWTH
 +}
 +
 +enum InvestmentRecommendationType {
 +
 +  ACQUISITION
 +
 +  RENOVATION
 +
 +  REPLACEMENT
 +
 +  EXPANSION
 +
 +  OPTIMIZATION
 +
 +  DIVESTMENT
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — Migration ======
 +
 +===== Générer =====
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name portfolio_intelligence
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-B ======
 +
 +===== Portfolio Intelligence Module =====
 +
 +----
 +
 +====== Étape 7 — Création ======
 +
 +<code>
 +src/modules/portfolio-intelligence
 +
 +├── forecasts
 +
 +├── revenue
 +
 +├── occupancy
 +
 +├── investments
 +
 +├── health
 +
 +├── insights
 +
 +└── portfolio-intelligence.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 8 — Services ======
 +
 +===== Créer =====
 +
 +<code>
 +PortfolioForecastService
 +
 +RevenueForecastService
 +
 +OccupancyForecastService
 +
 +InvestmentInsightService
 +
 +PortfolioHealthScoreService
 +
 +ExecutiveInsightService
 +
 +InvestmentRecommendationService
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-C ======
 +
 +===== Revenue Forecast =====
 +
 +----
 +
 +====== Étape 9 — RevenueForecastService ======
 +
 +===== Créer =====
 +
 +<code>
 +revenue-forecast.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +forecastRevenue()
 +
 +forecastADR()
 +
 +forecastRevPAR()
 +
 +forecastGrowth()
 +</code>
 +
 +----
 +
 +====== Étape 10 — Sources ======
 +
 +===== Utiliser =====
 +
 +<code>
 +Reservations
 +
 +Payments
 +
 +Invoices
 +
 +Portfolio Analytics
 +
 +Seasonality
 +</code>
 +
 +----
 +
 +====== Étape 11 — Prévisions ======
 +
 +===== Produire =====
 +
 +<code>
 +30 jours
 +
 +90 jours
 +
 +12 mois
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-D ======
 +
 +===== Occupancy Forecast =====
 +
 +----
 +
 +====== Étape 12 — OccupancyForecastService ======
 +
 +===== Créer =====
 +
 +<code>
 +occupancy-forecast.service.ts
 +</code>
 +
 +----
 +
 +===== Prévoir =====
 +
 +<code>
 +Occupancy
 +
 +Available Nights
 +
 +Demand
 +
 +Booking Pace
 +</code>
 +
 +----
 +
 +====== Étape 13 — Méthodes ======
 +
 +<code ts>
 +forecastOccupancy()
 +
 +forecastDemand()
 +
 +forecastSeasonality()
 +</code>
 +
 +----
 +
 +====== Étape 14 — Segmentation ======
 +
 +===== Calculer =====
 +
 +par :
 +
 +<code>
 +Portfolio
 +
 +Property Group
 +
 +Property
 +
 +Region
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-E ======
 +
 +===== Investment Insights =====
 +
 +----
 +
 +====== Étape 15 — InvestmentInsightService ======
 +
 +===== Créer =====
 +
 +<code>
 +investment-insight.service.ts
 +</code>
 +
 +----
 +
 +===== Identifier =====
 +
 +<code>
 +Expansion
 +
 +Renovation
 +
 +Asset Replacement
 +
 +Optimization
 +
 +Divestment
 +</code>
 +
 +----
 +
 +====== Étape 16 — Analyse ======
 +
 +===== Utiliser =====
 +
 +<code>
 +Revenue
 +
 +Occupancy
 +
 +Assets
 +
 +Maintenance
 +
 +Guest Satisfaction
 +</code>
 +
 +----
 +
 +====== Étape 17 — Exemple ======
 +
 +<code>
 +Property Group Paris
 +
 +ROI potentiel
 +
 +18%
 +
 +
 +
 +Rénovation recommandée
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-F ======
 +
 +===== Portfolio Health Score =====
 +
 +----
 +
 +====== Étape 18 — PortfolioHealthScoreService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-health-score.service.ts
 +</code>
 +
 +----
 +
 +===== Calcul =====
 +
 +<code>
 +Revenue           25%
 +
 +Occupancy         20%
 +
 +Guest Score       15%
 +
 +Operations        15%
 +
 +Assets            15%
 +
 +Growth            10%
 +</code>
 +
 +----
 +
 +====== Étape 19 — Classification ======
 +
 +<code>
 +90-100 Excellent
 +
 +75-89 Healthy
 +
 +50-74 Warning
 +
 +0-49 Critical
 +</code>
 +
 +----
 +
 +====== Étape 20 — Exemple ======
 +
 +<code>
 +Portfolio Health
 +
 +93
 +
 +Excellent
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-G ======
 +
 +===== Executive AI Insights =====
 +
 +----
 +
 +====== Étape 21 — ExecutiveInsightService ======
 +
 +===== Créer =====
 +
 +<code>
 +executive-insight.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +Revenue Opportunities
 +
 +Occupancy Risks
 +
 +Growth Opportunities
 +
 +Asset Risks
 +
 +Investment Priorities
 +</code>
 +
 +----
 +
 +====== Étape 22 — Exemple ======
 +
 +<code>
 +Les propriétés côtières
 +
 +↑ 22%
 +
 +prévision revenus été
 +
 +
 +
 +Renforcer l'inventaire
 +</code>
 +
 +----
 +
 +====== Étape 23 — Exemple ======
 +
 +<code>
 +Le groupe Europe Nord
 +
 +
 +
 +Occupation en baisse
 +
 +-7%
 +
 +
 +
 +Action recommandée
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-H ======
 +
 +===== Recommandations d'Investissement =====
 +
 +----
 +
 +====== Étape 24 — InvestmentRecommendationService ======
 +
 +===== Créer =====
 +
 +<code>
 +investment-recommendation.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +CAPEX
 +
 +Expansion
 +
 +Acquisition
 +
 +Renovation
 +
 +Cession
 +</code>
 +
 +----
 +
 +====== Étape 25 — Priorisation ======
 +
 +===== Utiliser =====
 +
 +<code>
 +ROI
 +
 +Health Score
 +
 +Forecast
 +
 +Asset Age
 +
 +Revenue Potential
 +</code>
 +
 +----
 +
 +====== Étape 26 — Exemple ======
 +
 +<code>
 +CAPEX
 +
 +250 000 €
 +
 +ROI estimé
 +
 +31%
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-I ======
 +
 +===== Dashboard Intelligence =====
 +
 +----
 +
 +====== Étape 27 — Endpoints ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /portfolio/intelligence
 +
 +GET /portfolio/forecasts
 +
 +GET /portfolio/insights
 +
 +GET /portfolio/health
 +
 +GET /portfolio/investments
 +
 +GET /portfolio/recommendations
 +</code>
 +
 +----
 +
 +====== Étape 28 — Exemple ======
 +
 +===== Réponse =====
 +
 +<code json>
 +{
 +  "revenueForecast":12450000,
 +  "occupancyForecast":84.2,
 +  "portfolioHealth":93,
 +  "investmentOpportunities":12
 +}
 +</code>
 +
 +----
 +
 +====== Étape 29 — Analytics IA ======
 +
 +===== Mesurer =====
 +
 +<code>
 +Forecast Accuracy
 +
 +Investment ROI
 +
 +Health Score Trend
 +
 +Revenue Prediction Accuracy
 +
 +Recommendation Adoption
 +</code>
 +
 +----
 +
 +====== Sprint 6-C.2-J ======
 +
 +===== Gouvernance =====
 +
 +----
 +
 +====== Étape 30 — Permissions ======
 +
 +===== Ajouter =====
 +
 +<code>
 +portfolio.intelligence.read
 +
 +portfolio.intelligence.forecast
 +
 +portfolio.intelligence.investment
 +
 +portfolio.intelligence.health
 +
 +portfolio.intelligence.executive
 +</code>
 +
 +----
 +
 +====== Étape 31 — Audit ======
 +
 +===== Journaliser =====
 +
 +<code>
 +PORTFOLIO_FORECAST_GENERATED
 +
 +PORTFOLIO_HEALTH_UPDATED
 +
 +EXECUTIVE_INSIGHT_CREATED
 +
 +INVESTMENT_RECOMMENDATION_CREATED
 +
 +INTELLIGENCE_DASHBOARD_VIEWED
 +</code>
 +
 +----
 +
 +====== Étape 32 — Jobs ======
 +
 +===== Ajouter =====
 +
 +<code>
 +Toutes les nuits
 +
 +Portfolio Forecast Refresh
 +
 +Portfolio Health Refresh
 +
 +Executive Insights Generation
 +
 +Investment Recommendation Refresh
 +</code>
 +
 +----
 +
 +====== Clôture Domaine Analytics ======
 +
 +À la fin du Sprint 6-C.2 :
 +
 +<code>
 +✓ Portfolio Analytics
 +
 +✓ Benchmarking
 +
 +✓ Forecasting
 +
 +✓ Executive Reporting
 +
 +✓ Portfolio Health Score
 +
 +✓ Investment Intelligence
 +
 +✓ Executive AI Insights
 +</code>
 +
 +sont entièrement opérationnels.
 +
 +----
 +
 +====== Préparation Sprint 6-D ======
 +
 +Compatible avec :
 +
 +<code>
 +Governance
 +
 +Delegation
 +
 +Approvals
 +
 +Compliance
 +
 +Enterprise Controls
 +</code>
 +
 +----
 +
 +====== Définition de terminé ======
 +
 +Le Sprint 6-C.2 est terminé lorsque :
 +
 +<code>
 +✓ Portfolio Forecasting créé
 +
 +✓ Revenue Forecast créé
 +
 +✓ Occupancy Forecast créé
 +
 +✓ Investment Insights créés
 +
 +✓ Portfolio Health Score créé
 +
 +✓ Executive AI Insights créés
 +
 +✓ Audit intégré
 +</code>
 +
 +----
 +
 +====== Livrables ======
 +
 +<code>
 +PortfolioForecast
 +
 +PortfolioInsight
 +
 +PortfolioHealthScore
 +
 +InvestmentRecommendation
 +
 +PortfolioForecastService
 +
 +RevenueForecastService
 +
 +OccupancyForecastService
 +
 +InvestmentInsightService
 +
 +PortfolioHealthScoreService
 +
 +ExecutiveInsightService
 +
 +InvestmentRecommendationService
 +
 +Portfolio Intelligence Platform
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1 — Enterprise Governance & Multi-Site Security ======
 +
 +===== Objectif =====
 +
 +Mettre en place la couche de gouvernance Enterprise du parc immobilier.
 +
 +Cette couche permet de contrôler :
 +
 +<code>
 +Accès
 +
 +Délégations
 +
 +Validations
 +
 +Conformité
 +
 +Séparation des responsabilités
 +
 +Traçabilité
 +</code>
 +
 +sur l'ensemble des portefeuilles, groupes et propriétés.
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Portfolio RBAC
 +
 +✓ Delegation
 +
 +✓ Approval Workflow
 +
 +✓ Compliance Controls
 +
 +✓ Multi-Site Permissions
 +
 +✓ Governance Dashboard
 +
 +✓ Enterprise Governance Platform
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Tenant
 +
 +
 +
 +Governance Layer
 +
 +├── RBAC
 +├── Delegation
 +├── Approval Workflow
 +├── Compliance
 +├── Audit
 +└── Governance Dashboard
 +
 +
 +
 +Portfolio
 +
 +
 +
 +Property Groups
 +
 +
 +
 +Properties
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — PortfolioRole ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model PortfolioRole {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  name                  String
 +
 +  code                  String
 +
 +  description           String?
 +
 +  systemRole            Boolean
 +                        @default(false)
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  updatedAt             DateTime
 +                        @updatedAt
 +
 +  permissions           PortfolioPermission[]
 +
 +  assignments           PortfolioRoleAssignment[]
 +
 +  @@unique([tenantId, code])
 +
 +  @@index([tenantId])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — PortfolioPermission ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioPermission {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  roleId                String
 +
 +  permission            String
 +
 +  role                  PortfolioRole
 +                        @relation(
 +                          fields:[roleId],
 +                          references:[id],
 +                          onDelete:Cascade
 +                        )
 +
 +  @@index([roleId])
 +
 +  @@index([permission])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — PortfolioRoleAssignment ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model PortfolioRoleAssignment {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  userId                String
 +
 +  roleId                String
 +
 +  portfolioId           String?
 +
 +  propertyGroupId       String?
 +
 +  propertyId            String?
 +
 +  assignedAt            DateTime
 +                        @default(now())
 +
 +  expiresAt             DateTime?
 +
 +  role                  PortfolioRole
 +                        @relation(
 +                          fields:[roleId],
 +                          references:[id]
 +                        )
 +
 +  @@index([tenantId])
 +
 +  @@index([userId])
 +
 +  @@index([portfolioId])
 +
 +  @@index([propertyId])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — Delegation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model Delegation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  delegatorUserId       String
 +
 +  delegateUserId        String
 +
 +  portfolioId           String?
 +
 +  propertyGroupId       String?
 +
 +  propertyId            String?
 +
 +  startDate             DateTime
 +
 +  endDate               DateTime
 +
 +  active                Boolean
 +                        @default(true)
 +
 +  reason                String?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([delegatorUserId])
 +
 +  @@index([delegateUserId])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — ApprovalRequest ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model ApprovalRequest {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  approvalType          ApprovalType
 +
 +  status                ApprovalStatus
 +
 +  entityType            String
 +
 +  entityId              String
 +
 +  requestedBy           String
 +
 +  approvedBy            String?
 +
 +  requestedAt           DateTime
 +                        @default(now())
 +
 +  approvedAt            DateTime?
 +
 +  comment               String?
 +
 +  @@index([tenantId])
 +
 +  @@index([status])
 +
 +  @@index([approvalType])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — ComplianceControl ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model ComplianceControl {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  code                  String
 +
 +  title                 String
 +
 +  category              ComplianceCategory
 +
 +  enabled               Boolean
 +                        @default(true)
 +
 +  severity              ComplianceSeverity
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +
 +  @@index([category])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 7 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum ApprovalType {
 +
 +  PROPERTY_CREATION
 +
 +  PROPERTY_UPDATE
 +
 +  OWNER_ASSIGNMENT
 +
 +  OPERATOR_ASSIGNMENT
 +
 +  CAPEX_REQUEST
 +
 +  CONTRACT_APPROVAL
 +}
 +
 +enum ApprovalStatus {
 +
 +  PENDING
 +
 +  APPROVED
 +
 +  REJECTED
 +
 +  CANCELLED
 +}
 +
 +enum ComplianceCategory {
 +
 +  SECURITY
 +
 +  FINANCIAL
 +
 +  LEGAL
 +
 +  GDPR
 +
 +  OPERATIONS
 +}
 +
 +enum ComplianceSeverity {
 +
 +  LOW
 +
 +  MEDIUM
 +
 +  HIGH
 +
 +  CRITICAL
 +}
 +</code>
 +
 +----
 +
 +====== Étape 8 — Migration ======
 +
 +===== Générer =====
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name governance_core
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-B ======
 +
 +===== Governance Module =====
 +
 +----
 +
 +====== Étape 9 — Création ======
 +
 +<code>
 +src/modules/governance
 +
 +├── roles
 +
 +├── permissions
 +
 +├── delegations
 +
 +├── approvals
 +
 +├── compliance
 +
 +├── dashboard
 +
 +└── governance.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 10 — Services ======
 +
 +===== Créer =====
 +
 +<code>
 +PortfolioRBACService
 +
 +DelegationService
 +
 +ApprovalWorkflowService
 +
 +ComplianceControlService
 +
 +GovernanceDashboardService
 +
 +PermissionResolverService
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-C ======
 +
 +===== Portfolio RBAC =====
 +
 +----
 +
 +====== Étape 11 — PortfolioRBACService ======
 +
 +===== Créer =====
 +
 +<code>
 +portfolio-rbac.service.ts
 +</code>
 +
 +----
 +
 +===== Rôles système =====
 +
 +<code>
 +PORTFOLIO_ADMIN
 +
 +PORTFOLIO_MANAGER
 +
 +GROUP_MANAGER
 +
 +PROPERTY_MANAGER
 +
 +OWNER_VIEWER
 +
 +AUDITOR
 +</code>
 +
 +----
 +
 +====== Étape 12 — Permissions ======
 +
 +===== Supporter =====
 +
 +<code>
 +Read
 +
 +Create
 +
 +Update
 +
 +Delete
 +
 +Approve
 +
 +Export
 +
 +Admin
 +</code>
 +
 +par scope.
 +
 +----
 +
 +====== Étape 13 — Scopes ======
 +
 +===== Appliquer =====
 +
 +<code>
 +Portfolio
 +
 +Property Group
 +
 +Property
 +</code>
 +
 +sur chaque permission.
 +
 +----
 +
 +====== Sprint 6-D.1-D ======
 +
 +===== Délégations =====
 +
 +----
 +
 +====== Étape 14 — DelegationService ======
 +
 +===== Créer =====
 +
 +<code>
 +delegation.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +createDelegation()
 +
 +revokeDelegation()
 +
 +validateDelegation()
 +
 +getActiveDelegations()
 +</code>
 +
 +----
 +
 +====== Étape 15 — Cas d'usage ======
 +
 +===== Supporter =====
 +
 +<code>
 +Congés
 +
 +Remplacement
 +
 +Mission temporaire
 +
 +Support régional
 +</code>
 +
 +----
 +
 +====== Étape 16 — Expiration ======
 +
 +===== Désactiver =====
 +
 +automatiquement à :
 +
 +<code>
 +endDate
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-E ======
 +
 +===== Workflow d'Approbation =====
 +
 +----
 +
 +====== Étape 17 — ApprovalWorkflowService ======
 +
 +===== Créer =====
 +
 +<code>
 +approval-workflow.service.ts
 +</code>
 +
 +----
 +
 +===== Méthodes =====
 +
 +<code ts>
 +submitApproval()
 +
 +approve()
 +
 +reject()
 +
 +cancelApproval()
 +</code>
 +
 +----
 +
 +====== Étape 18 — Workflows ======
 +
 +===== Supporter =====
 +
 +<code>
 +Nouvelle propriété
 +
 +Changement propriétaire
 +
 +CAPEX
 +
 +Contrat
 +
 +Suppression actif
 +</code>
 +
 +----
 +
 +====== Étape 19 — Validation ======
 +
 +===== Exiger =====
 +
 +un approbateur différent du demandeur.
 +
 +----
 +
 +====== Sprint 6-D.1-F ======
 +
 +===== Contrôles de Conformité =====
 +
 +----
 +
 +====== Étape 20 — ComplianceControlService ======
 +
 +===== Créer =====
 +
 +<code>
 +compliance-control.service.ts
 +</code>
 +
 +----
 +
 +===== Vérifier =====
 +
 +<code>
 +RGPD
 +
 +Audit
 +
 +Sécurité
 +
 +Finance
 +
 +Exploitation
 +</code>
 +
 +----
 +
 +====== Étape 21 — Méthodes ======
 +
 +<code ts>
 +runControls()
 +
 +evaluateCompliance()
 +
 +createViolation()
 +
 +closeViolation()
 +</code>
 +
 +----
 +
 +====== Étape 22 — Scores ======
 +
 +===== Calculer =====
 +
 +<code>
 +Compliance Score
 +
 +Risk Score
 +
 +Violation Rate
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-G ======
 +
 +===== Dashboard Gouvernance =====
 +
 +----
 +
 +====== Étape 23 — GovernanceDashboardService ======
 +
 +===== Créer =====
 +
 +<code>
 +governance-dashboard.service.ts
 +</code>
 +
 +----
 +
 +===== Afficher =====
 +
 +<code>
 +Approvals Pending
 +
 +Active Delegations
 +
 +Compliance Score
 +
 +Open Violations
 +
 +Audit Events
 +</code>
 +
 +----
 +
 +====== Étape 24 — KPI ======
 +
 +===== Mesurer =====
 +
 +<code>
 +Approval Time
 +
 +Compliance Rate
 +
 +Policy Violations
 +
 +Delegation Usage
 +
 +Audit Coverage
 +</code>
 +
 +----
 +
 +====== Étape 25 — Endpoint ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET /governance/dashboard
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-H ======
 +
 +===== API Gouvernance =====
 +
 +----
 +
 +====== Étape 26 — Endpoints ======
 +
 +===== Ajouter =====
 +
 +<code http>
 +GET    /governance/roles
 +
 +POST   /governance/roles
 +
 +GET    /governance/delegations
 +
 +POST   /governance/delegations
 +
 +GET    /governance/approvals
 +
 +POST   /governance/approvals
 +
 +POST   /governance/approvals/{id}/approve
 +
 +POST   /governance/approvals/{id}/reject
 +
 +GET    /governance/compliance
 +</code>
 +
 +----
 +
 +====== Étape 27 — Exemple ======
 +
 +===== Approbation =====
 +
 +<code json>
 +{
 +  "approvalType":"CAPEX_REQUEST",
 +  "entityType":"Asset",
 +  "entityId":"ast_123"
 +}
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-I ======
 +
 +===== Sécurité Enterprise =====
 +
 +----
 +
 +====== Étape 28 — Permission Resolver ======
 +
 +===== Créer =====
 +
 +<code>
 +permission-resolver.service.ts
 +</code>
 +
 +----
 +
 +===== Résoudre =====
 +
 +dans l'ordre :
 +
 +<code>
 +Role
 +
 +
 +
 +Delegation
 +
 +
 +
 +Portfolio Scope
 +
 +
 +
 +Property Scope
 +</code>
 +
 +----
 +
 +====== Étape 29 — Middleware ======
 +
 +===== Ajouter =====
 +
 +<code ts>
 +@RequirePortfolioPermission()
 +
 +@RequireApproval()
 +</code>
 +
 +----
 +
 +====== Étape 30 — Audit ======
 +
 +===== Journaliser =====
 +
 +<code>
 +ROLE_ASSIGNED
 +
 +DELEGATION_CREATED
 +
 +APPROVAL_SUBMITTED
 +
 +APPROVAL_APPROVED
 +
 +COMPLIANCE_CHECK_EXECUTED
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.1-J ======
 +
 +===== Gouvernance Continue =====
 +
 +----
 +
 +====== Étape 31 — Jobs ======
 +
 +===== Ajouter =====
 +
 +<code>
 +Toutes les heures
 +
 +Delegation Expiration
 +
 +Toutes les nuits
 +
 +Compliance Scan
 +
 +Approval Escalation
 +
 +Governance KPI Refresh
 +</code>
 +
 +----
 +
 +====== Étape 32 — Permissions ======
 +
 +===== Ajouter =====
 +
 +<code>
 +governance.read
 +
 +governance.manage
 +
 +governance.approve
 +
 +governance.compliance
 +
 +governance.audit
 +
 +governance.admin
 +</code>
 +
 +----
 +
 +====== Préparation Sprint 6-D.2 ======
 +
 +Compatible avec :
 +
 +<code>
 +Enterprise Policies
 +
 +Risk Management
 +
 +Internal Controls
 +
 +Governance Intelligence
 +
 +Audit Automation
 +</code>
 +
 +----
 +
 +====== Définition de terminé ======
 +
 +Le Sprint 6-D.1 est terminé lorsque :
 +
 +<code>
 +✓ Portfolio RBAC créé
 +
 +✓ Delegation créée
 +
 +✓ Approval Workflow créé
 +
 +✓ Compliance Controls créés
 +
 +✓ Multi-Site Permissions créées
 +
 +✓ Governance Dashboard créé
 +
 +✓ Audit intégré
 +</code>
 +
 +----
 +
 +====== Livrables ======
 +
 +<code>
 +PortfolioRole
 +
 +PortfolioPermission
 +
 +PortfolioRoleAssignment
 +
 +Delegation
 +
 +ApprovalRequest
 +
 +ComplianceControl
 +
 +PortfolioRBACService
 +
 +DelegationService
 +
 +ApprovalWorkflowService
 +
 +ComplianceControlService
 +
 +GovernanceDashboardService
 +
 +Enterprise Governance Platform
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2 — Governance Intelligence & Risk Management ======
 +
 +===== Objectif =====
 +
 +Transformer la gouvernance opérationnelle en plateforme de pilotage des risques Enterprise.
 +
 +Cette couche permet :
 +
 +<code>
 +Gestion des risques
 +
 +Politiques Enterprise
 +
 +Contrôles internes
 +
 +Prévision conformité
 +
 +Analyse d'audit
 +
 +Pilotage exécutif
 +</code>
 +
 +sur l'ensemble des portefeuilles, groupes et propriétés.
 +
 +À l'issue de cette étape :
 +
 +<code>
 +✓ Risk Engine
 +
 +✓ Policy Engine
 +
 +✓ Segregation of Duties
 +
 +✓ Audit Intelligence
 +
 +✓ Compliance Forecasting
 +
 +✓ Governance Score
 +
 +✓ Governance Intelligence Platform
 +</code>
 +
 +----
 +
 +====== Architecture cible ======
 +
 +<code>
 +Governance Layer
 +
 +
 +
 +Governance Intelligence Engine
 +
 +├── Risk Engine
 +├── Policy Engine
 +├── SoD Engine
 +├── Audit Intelligence
 +├── Compliance Forecasting
 +├── Governance Score
 +└── Executive Recommendations
 +
 +
 +
 +Executive Governance
 +
 +
 +
 +Enterprise Controls
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-A ======
 +
 +===== Extension Prisma =====
 +
 +----
 +
 +====== Étape 1 — GovernanceRisk ======
 +
 +===== Ajouter dans schema.prisma =====
 +
 +<code prisma>
 +model GovernanceRisk {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  portfolioId           String?
 +
 +  propertyGroupId       String?
 +
 +  propertyId            String?
 +
 +  category              RiskCategory
 +
 +  severity              RiskSeverity
 +
 +  title                 String
 +
 +  description           String
 +
 +  riskScore             Float
 +
 +  likelihood            Float?
 +
 +  impact                Float?
 +
 +  mitigationPlan        String?
 +
 +  ownerUserId           String?
 +
 +  status                RiskStatus
 +
 +  detectedAt            DateTime
 +                        @default(now())
 +
 +  resolvedAt            DateTime?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +  @@index([category])
 +  @@index([severity])
 +  @@index([status])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 2 — GovernancePolicy ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model GovernancePolicy {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  code                  String
 +
 +  title                 String
 +
 +  description           String?
 +
 +  category              PolicyCategory
 +
 +  active                Boolean
 +                        @default(true)
 +
 +  version               String
 +
 +  effectiveDate         DateTime?
 +
 +  reviewDate            DateTime?
 +
 +  createdAt             DateTime
 +                        @default(now())
 +
 +  updatedAt             DateTime
 +                        @updatedAt
 +
 +  @@unique([tenantId, code])
 +
 +  @@index([tenantId])
 +  @@index([category])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 3 — SoDViolation ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model SoDViolation {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  userId                String
 +
 +  ruleCode              String
 +
 +  conflictDescription   String
 +
 +  severity              RiskSeverity
 +
 +  resolved              Boolean
 +                        @default(false)
 +
 +  detectedAt            DateTime
 +                        @default(now())
 +
 +  resolvedAt            DateTime?
 +
 +  @@index([tenantId])
 +  @@index([userId])
 +  @@index([resolved])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 4 — GovernanceForecast ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model GovernanceForecast {
 +
 +  id                    String
 +                        @id
 +                        @default(uuid())
 +
 +  tenantId              String
 +
 +  forecastType          GovernanceForecastType
 +
 +  forecastDate          DateTime
 +
 +  predictedValue        Float
 +
 +  confidenceScore       Float?
 +
 +  generatedAt           DateTime
 +                        @default(now())
 +
 +  @@index([tenantId])
 +  @@index([forecastType])
 +  @@index([forecastDate])
 +}
 +</code>
 +
 +----
 +
 +====== Étape 5 — GovernanceScore ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +model GovernanceScore {
 +
 +  tenantId              String
 +                        @id
 +
 +  overallScore          Float
 +
 +  complianceScore       Float
 +
 +  auditScore            Float
 +
 +  riskScore             Float
 +
 +  controlsScore         Float
 +
 +  segregationScore      Float
 +
 +  calculatedAt          DateTime
 +                        @updatedAt
 +}
 +</code>
 +
 +----
 +
 +====== Étape 6 — Enums ======
 +
 +===== Ajouter =====
 +
 +<code prisma>
 +enum RiskCategory {
 +
 +  SECURITY
 +
 +  FINANCIAL
 +
 +  OPERATIONAL
 +
 +  COMPLIANCE
 +
 +  LEGAL
 +
 +  GOVERNANCE
 +}
 +
 +enum RiskSeverity {
 +
 +  LOW
 +
 +  MEDIUM
 +
 +  HIGH
 +
 +  CRITICAL
 +}
 +
 +enum RiskStatus {
 +
 +  OPEN
 +
 +  MITIGATING
 +
 +  ACCEPTED
 +
 +  RESOLVED
 +}
 +
 +enum PolicyCategory {
 +
 +  ACCESS
 +
 +  SECURITY
 +
 +  FINANCE
 +
 +  OPERATIONS
 +
 +  GDPR
 +
 +  AUDIT
 +}
 +
 +enum GovernanceForecastType {
 +
 +  COMPLIANCE_SCORE
 +
 +  RISK_EXPOSURE
 +
 +  AUDIT_FINDINGS
 +
 +  POLICY_VIOLATIONS
 +}
 +</code>
 +
 +----
 +
 +====== Étape 7 — Migration ======
 +
 +<code bash>
 +npx prisma migrate dev \
 +--name governance_intelligence
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-B ======
 +
 +===== Governance Intelligence Module =====
 +
 +----
 +
 +====== Étape 8 — Structure ======
 +
 +<code>
 +src/modules/governance-intelligence
 +
 +├── risk
 +├── policy
 +├── sod
 +├── audit
 +├── forecasting
 +├── scoring
 +├── recommendations
 +└── governance-intelligence.module.ts
 +</code>
 +
 +----
 +
 +====== Étape 9 — Services ======
 +
 +<code>
 +RiskEngineService
 +
 +PolicyEngineService
 +
 +SegregationOfDutiesService
 +
 +AuditIntelligenceService
 +
 +ComplianceForecastingService
 +
 +GovernanceScoreService
 +
 +GovernanceRecommendationService
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-C ======
 +
 +===== Risk Engine =====
 +
 +----
 +
 +====== Étape 10 — RiskEngineService ======
 +
 +===== Créer =====
 +
 +<code>
 +risk-engine.service.ts
 +</code>
 +
 +----
 +
 +===== Capacités =====
 +
 +<code>
 +Risk Registry
 +
 +Risk Scoring
 +
 +Risk Classification
 +
 +Risk Mitigation
 +
 +Risk Monitoring
 +</code>
 +
 +----
 +
 +====== Étape 11 — Détecter ======
 +
 +<code>
 +Accès excessifs
 +
 +Violations politiques
 +
 +Fraudes potentielles
 +
 +Conflits SoD
 +
 +Défauts conformité
 +
 +Anomalies d'audit
 +</code>
 +
 +----
 +
 +====== Étape 12 — Méthodes ======
 +
 +<code ts>
 +detectRisks()
 +
 +calculateRiskScore()
 +
 +classifyRisk()
 +
 +createMitigationPlan()
 +
 +resolveRisk()
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-D ======
 +
 +===== Policy Engine =====
 +
 +----
 +
 +====== Étape 13 — PolicyEngineService ======
 +
 +===== Créer =====
 +
 +<code>
 +policy-engine.service.ts
 +</code>
 +
 +----
 +
 +===== Supporter =====
 +
 +<code>
 +Policies
 +
 +Rules
 +
 +Exceptions
 +
 +Escalations
 +
 +Approvals
 +</code>
 +
 +----
 +
 +====== Étape 14 — Méthodes ======
 +
 +<code ts>
 +evaluatePolicy()
 +
 +registerException()
 +
 +validateAction()
 +
 +triggerEscalation()
 +
 +auditExecution()
 +</code>
 +
 +----
 +
 +====== Étape 15 — Exemples ======
 +
 +<code>
 +CAPEX > 50 000 €
 +
 +
 +
 +Double approbation
 +</code>
 +
 +----
 +
 +<code>
 +Suppression propriété
 +
 +
 +
 +Validation exécutive
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-E ======
 +
 +===== Segregation of Duties =====
 +
 +----
 +
 +====== Étape 16 — SegregationOfDutiesService ======
 +
 +===== Créer =====
 +
 +<code>
 +segregation-of-duties.service.ts
 +</code>
 +
 +----
 +
 +===== Contrôler =====
 +
 +<code>
 +Création
 +
 +Validation
 +
 +Paiement
 +
 +Audit
 +
 +Administration
 +</code>
 +
 +----
 +
 +====== Étape 17 — Détection ======
 +
 +===== Identifier =====
 +
 +<code>
 +Demandeur + Approbateur
 +
 +Créateur + Auditeur
 +
 +Administrateur + Contrôleur
 +</code>
 +
 +----
 +
 +====== Étape 18 — Méthodes ======
 +
 +<code ts>
 +detectConflict()
 +
 +validateRoleAssignment()
 +
 +createViolation()
 +
 +resolveViolation()
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-F ======
 +
 +===== Audit Intelligence =====
 +
 +----
 +
 +====== Étape 19 — AuditIntelligenceService ======
 +
 +===== Créer =====
 +
 +<code>
 +audit-intelligence.service.ts
 +</code>
 +
 +----
 +
 +===== Analyser =====
 +
 +<code>
 +Audit Logs
 +
 +Approvals
 +
 +Permissions
 +
 +Violations
 +
 +Incidents
 +</code>
 +
 +----
 +
 +====== Étape 20 — Détecter ======
 +
 +<code>
 +Anomalies
 +
 +Patterns
 +
 +Abus potentiels
 +
 +Contrôles manquants
 +
 +Zones à risque
 +</code>
 +
 +----
 +
 +====== Étape 21 — Méthodes ======
 +
 +<code ts>
 +analyzeAuditLogs()
 +
 +detectAnomalies()
 +
 +generateFindings()
 +
 +identifyControlGaps()
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-G ======
 +
 +===== Compliance Forecasting =====
 +
 +----
 +
 +====== Étape 22 — ComplianceForecastingService ======
 +
 +===== Créer =====
 +
 +<code>
 +compliance-forecasting.service.ts
 +</code>
 +
 +----
 +
 +===== Prévoir =====
 +
 +<code>
 +Violations
 +
 +Audit Findings
 +
 +Risk Exposure
 +
 +Compliance Trend
 +</code>
 +
 +----
 +
 +====== Étape 23 — Sources ======
 +
 +<code>
 +Compliance Controls
 +
 +Audit Logs
 +
 +Governance Risks
 +
 +SoD Violations
 +</code>
 +
 +----
 +
 +====== Étape 24 — Méthodes ======
 +
 +<code ts>
 +forecastCompliance()
 +
 +forecastRiskExposure()
 +
 +forecastAuditFindings()
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-H ======
 +
 +===== Governance Score =====
 +
 +----
 +
 +====== Étape 25 — GovernanceScoreService ======
 +
 +===== Créer =====
 +
 +<code>
 +governance-score.service.ts
 +</code>
 +
 +----
 +
 +===== Pondération =====
 +
 +<code>
 +Compliance        25%
 +
 +Risk              25%
 +
 +Audit             20%
 +
 +Controls          15%
 +
 +SoD               15%
 +</code>
 +
 +----
 +
 +====== Étape 26 — Classification ======
 +
 +<code>
 +90-100  Excellent
 +
 +75-89   Healthy
 +
 +50-74   Warning
 +
 +0-49    Critical
 +</code>
 +
 +----
 +
 +====== Étape 27 — Exemple ======
 +
 +<code>
 +Governance Score
 +
 +94
 +
 +Excellent
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-I ======
 +
 +===== Executive Intelligence =====
 +
 +----
 +
 +====== Étape 28 — GovernanceRecommendationService ======
 +
 +===== Créer =====
 +
 +<code>
 +governance-recommendation.service.ts
 +</code>
 +
 +----
 +
 +===== Générer =====
 +
 +<code>
 +Réduction risques
 +
 +Renforcement contrôles
 +
 +Corrections conformité
 +
 +Optimisation processus
 +
 +Actions audit
 +</code>
 +
 +----
 +
 +====== Étape 29 — Exemples ======
 +
 +<code>
 +18 violations SoD
 +
 +
 +
 +Séparer les rôles Finance
 +</code>
 +
 +----
 +
 +<code>
 +Risque conformité en hausse
 +
 +
 +
 +Audit ciblé recommandé
 +</code>
 +
 +----
 +
 +====== Sprint 6-D.2-J ======
 +
 +===== Dashboard Intelligence =====
 +
 +----
 +
 +====== Étape 30 — Endpoints ======
 +
 +<code http>
 +GET /governance/intelligence
 +
 +GET /governance/risks
 +
 +GET /governance/policies
 +
 +GET /governance/score
 +
 +GET /governance/forecasts
 +
 +GET /governance/recommendations
 +
 +GET /governance/sod
 +</code>
 +
 +----
 +
 +====== Étape 31 — Exemple ======
 +
 +<code json>
 +{
 +  "governanceScore":94,
 +  "openRisks":7,
 +  "criticalRisks":1,
 +  "sodViolations":3,
 +  "complianceForecast":91
 +}
 +</code>
 +
 +----
 +
 +====== Étape 32 — Permissions ======
 +
 +<code>
 +governance.intelligence.read
 +
 +governance.risk.manage
 +
 +governance.policy.manage
 +
 +governance.audit.intelligence
 +
 +governance.executive
 +</code>
 +
 +----
 +
 +====== Étape 33 — Audit ======
 +
 +<code>
 +RISK_DETECTED
 +
 +POLICY_VIOLATION
 +
 +SOD_VIOLATION_CREATED
 +
 +FORECAST_GENERATED
 +
 +GOVERNANCE_SCORE_UPDATED
 +
 +EXECUTIVE_RECOMMENDATION_CREATED
 +</code>
 +
 +----
 +
 +====== Étape 34 — Jobs ======
 +
 +<code>
 +Toutes les heures
 +
 +Risk Detection
 +
 +Toutes les nuits
 +
 +Compliance Forecast Refresh
 +
 +Governance Score Refresh
 +
 +Audit Intelligence Refresh
 +
 +Recommendation Generation
 +</code>
 +
 +----
 +
 +====== Clôture Sprint 6 ======
 +
 +À la fin du Sprint 6 :
 +
 +<code>
 +✓ Portfolio Management
 +
 +✓ Asset Management
 +
 +✓ Portfolio Analytics
 +
 +✓ Portfolio Intelligence
 +
 +✓ Enterprise Governance
 +
 +✓ Risk Management
 +
 +✓ Executive Controls
 +</code>
 +
 +sont entièrement opérationnels.
 +
 +----
 +
 +====== Préparation Sprint 7 ======
 +
 +Compatible avec :
 +
 +<code>
 +Marketplace
 +
 +OTA
 +
 +Distribution
 +
 +Partners
 +
 +Channels
 +
 +Revenue Sharing
 +</code>
 +
 +----
 +
 +====== Définition de terminé ======
 +
 +Le Sprint 6-D.2 est terminé lorsque :
 +
 +<code>
 +✓ Risk Engine créé
 +
 +✓ Policy Engine créé
 +
 +✓ Segregation of Duties créée
 +
 +✓ Audit Intelligence créée
 +
 +✓ Compliance Forecasting créé
 +
 +✓ Governance Score créé
 +
 +✓ Executive Intelligence créée
 +
 +✓ Gouvernance Enterprise finalisée
 +</code>
 +
 +----
 +
 +====== Livrables ======
 +
 +<code>
 +GovernanceRisk
 +
 +GovernancePolicy
 +
 +SoDViolation
 +
 +GovernanceForecast
 +
 +GovernanceScore
 +
 +RiskEngineService
 +
 +PolicyEngineService
 +
 +SegregationOfDutiesService
 +
 +AuditIntelligenceService
 +
 +ComplianceForecastingService
 +
 +GovernanceScoreService
 +
 +GovernanceRecommendationService
 +
 +Governance Intelligence Platform
 </code> </code>
  
ujusum/3-codage/2-sprints/6-sprint-6.1781108824.txt.gz · Dernière modification : 2026/06/10 18:27 de 83.202.252.200

DokuWiki Appliance - Powered by TurnKey Linux