ujusum:3-codage:1-repository:2-prisma-schema
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| ujusum:3-codage:1-repository:2-prisma-schema [2026/06/07 18:38] – 91.170.108.99 | ujusum:3-codage:1-repository:2-prisma-schema [2026/06/07 19:04] (Version actuelle) – 91.170.108.99 | ||
|---|---|---|---|
| Ligne 4901: | Ligne 4901: | ||
| ---- | ---- | ||
| - | ====== | + | ====== |
| - | ===== Phase 2-I ===== | + | ===== Objectif |
| - | Administration, | + | Mettre en place la couche transverse de gouvernance de la plateforme. |
| + | |||
| + | Cette couche doit permettre : | ||
| + | |||
| + | * Audit complet des actions | ||
| + | * Historisation métier | ||
| + | * Activation dynamique de fonctionnalités | ||
| + | * Workflows métiers configurables | ||
| + | * Gouvernance | ||
| + | * Traçabilité réglementaire | ||
| + | * Préparation RGPD / ISO27001 / SOC2 | ||
| + | |||
| + | Cette phase prépare directement : | ||
| + | |||
| + | < | ||
| + | Sprint 10 — Reporting | ||
| + | |||
| + | Sprint 11 — Administration | ||
| + | |||
| + | Sprint 19 — Gouvernance & Conformité | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| < | < | ||
| Ligne 4923: | Ligne 4949: | ||
| </ | </ | ||
| - | Cette phase préparera directement : | + | ---- |
| - | * Sprint 10 Reporting | + | ====== AuditLog ====== |
| - | * Sprint 11 Administration | + | |
| - | * Sprint 19 Gouvernance | + | ===== Journal d' |
| + | |||
| + | Toutes les actions sensibles doivent être tracées. | ||
| + | |||
| + | <code prisma> | ||
| + | model AuditLog { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | userId | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | action | ||
| + | |||
| + | oldValues | ||
| + | |||
| + | newValues | ||
| + | |||
| + | ipAddress | ||
| + | |||
| + | userAgent | ||
| + | |||
| + | correlationId | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | user User? @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([entityType]) | ||
| + | |||
| + | @@index([entityId]) | ||
| + | |||
| + | @@index([action]) | ||
| + | |||
| + | @@index([createdAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== AuditAction ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum AuditAction { | ||
| + | |||
| + | CREATE | ||
| + | |||
| + | UPDATE | ||
| + | |||
| + | DELETE | ||
| + | |||
| + | RESTORE | ||
| + | |||
| + | LOGIN | ||
| + | |||
| + | LOGOUT | ||
| + | |||
| + | EXPORT | ||
| + | |||
| + | IMPORT | ||
| + | |||
| + | EXECUTE | ||
| + | |||
| + | APPROVE | ||
| + | |||
| + | REJECT | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== EntityHistory ====== | ||
| + | |||
| + | ===== Historisation métier ===== | ||
| + | |||
| + | Permet de reconstruire l' | ||
| + | |||
| + | <code prisma> | ||
| + | model EntityHistory { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | version | ||
| + | |||
| + | snapshot | ||
| + | |||
| + | createdByUserId | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | createdByUser | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | entityType, | ||
| + | entityId, | ||
| + | version | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([entityType]) | ||
| + | |||
| + | @@index([entityId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== FeatureFlag ====== | ||
| + | |||
| + | ===== Activation dynamique ===== | ||
| + | |||
| + | Permet de déployer progressivement des fonctionnalités. | ||
| + | |||
| + | <code prisma> | ||
| + | model FeatureFlag { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | enabled | ||
| + | |||
| + | configuration | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([enabled]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | AI_ASSISTANT | ||
| + | |||
| + | OWNER_PORTAL_V2 | ||
| + | |||
| + | OTA_SYNC | ||
| + | |||
| + | REVENUE_MANAGEMENT | ||
| + | |||
| + | ADVANCED_REPORTING | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Workflow ====== | ||
| + | |||
| + | ===== Définition d'un workflow ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Workflow { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | entityType | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | steps | ||
| + | |||
| + | instances | ||
| + | |||
| + | @@unique([tenantId, | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([entityType]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== WorkflowStep ====== | ||
| + | |||
| + | ===== Étapes du workflow ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model WorkflowStep { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | workflowId | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | position | ||
| + | |||
| + | approverRoleCode | ||
| + | |||
| + | automatic | ||
| + | |||
| + | configuration | ||
| + | |||
| + | workflow | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | workflowId, | ||
| + | code | ||
| + | ]) | ||
| + | |||
| + | @@index([workflowId]) | ||
| + | |||
| + | @@index([position]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | ReservationApproval | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ManagerApproval | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ContractGeneration | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | PaymentValidation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Completed | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== WorkflowInstance ====== | ||
| + | |||
| + | ===== Exécution métier ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model WorkflowInstance { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | workflowId | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | currentStepId | ||
| + | |||
| + | status | ||
| + | |||
| + | startedAt | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | workflow | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | currentStep | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | executions | ||
| + | |||
| + | @@index([workflowId]) | ||
| + | |||
| + | @@index([entityType]) | ||
| + | |||
| + | @@index([entityId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== WorkflowInstanceStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum WorkflowInstanceStatus { | ||
| + | |||
| + | RUNNING | ||
| + | |||
| + | WAITING | ||
| + | |||
| + | APPROVED | ||
| + | |||
| + | REJECTED | ||
| + | |||
| + | COMPLETED | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== WorkflowExecution ====== | ||
| + | |||
| + | ===== Historique des étapes ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model WorkflowExecution { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | workflowInstanceId | ||
| + | |||
| + | workflowStepId | ||
| + | |||
| + | executedByUserId | ||
| + | |||
| + | status | ||
| + | |||
| + | comments | ||
| + | |||
| + | executedAt | ||
| + | |||
| + | workflowInstance | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | workflowStep | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | executedByUser | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([workflowInstanceId]) | ||
| + | |||
| + | @@index([workflowStepId]) | ||
| + | |||
| + | @@index([executedAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== WorkflowExecutionStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum WorkflowExecutionStatus { | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | APPROVED | ||
| + | |||
| + | REJECTED | ||
| + | |||
| + | SKIPPED | ||
| + | |||
| + | COMPLETED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Relations à ajouter ====== | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | <code prisma> | ||
| + | auditLogs AuditLog[] | ||
| + | |||
| + | entityHistories EntityHistory[] | ||
| + | |||
| + | featureFlags FeatureFlag[] | ||
| + | |||
| + | workflows Workflow[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== User ===== | ||
| + | |||
| + | <code prisma> | ||
| + | auditLogs AuditLog[] | ||
| + | |||
| + | entityHistories EntityHistory[] | ||
| + | |||
| + | workflowExecutions WorkflowExecution[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Cas d' | ||
| + | |||
| + | ===== Réservation ===== | ||
| + | |||
| + | < | ||
| + | Reservation Created | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | AuditLog | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Workflow Instance | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Manager Approval | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Contract Generation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Paiement ===== | ||
| + | |||
| + | < | ||
| + | Payment Refunded | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | AuditLog | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | History Snapshot | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Compliance Trace | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Administration ===== | ||
| + | |||
| + | < | ||
| + | Feature Enabled | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | AuditLog | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | History | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Reporting | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name administration_audit_governance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== Administration ===== | ||
| + | |||
| + | < | ||
| + | Feature Flags | ||
| + | |||
| + | Workflows | ||
| + | |||
| + | Validation | ||
| + | |||
| + | Approbation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Audit ===== | ||
| + | |||
| + | < | ||
| + | Journalisation | ||
| + | |||
| + | Traçabilité | ||
| + | |||
| + | Historisation | ||
| + | |||
| + | Conformité | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Gouvernance ===== | ||
| + | |||
| + | < | ||
| + | Contrôle | ||
| + | |||
| + | Supervision | ||
| + | |||
| + | Rétention | ||
| + | |||
| + | Preuve d' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État du schéma ====== | ||
| + | |||
| + | Après Phase 2-I : | ||
| + | |||
| + | < | ||
| + | ≈ 74 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | avec les domaines : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 2-J — OTA & Channel Manager ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire le moteur de distribution multicanal de la plateforme. | ||
| + | |||
| + | Ce domaine permettra : | ||
| + | |||
| + | * Synchronisation Airbnb | ||
| + | * Synchronisation Booking.com | ||
| + | * Synchronisation Vrbo | ||
| + | * Synchronisation Abritel | ||
| + | * Publication automatique des biens | ||
| + | * Synchronisation des disponibilités | ||
| + | * Synchronisation des tarifs | ||
| + | * Synchronisation des réservations | ||
| + | * Gestion des erreurs de synchronisation | ||
| + | |||
| + | Cette phase couvre : | ||
| + | |||
| + | < | ||
| + | Sprint 12 — OTA & Distribution | ||
| + | |||
| + | Sprint 14 — API & Partenaires | ||
| + | |||
| + | Sprint 18 — Channel Manager Enterprise | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| + | |||
| + | < | ||
| + | Channel | ||
| + | |||
| + | ChannelConnection | ||
| + | |||
| + | PropertyDistribution | ||
| + | |||
| + | ChannelReservation | ||
| + | |||
| + | SyncExecution | ||
| + | |||
| + | SyncError | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Channel ====== | ||
| + | |||
| + | ===== Catalogue OTA ===== | ||
| + | |||
| + | Référentiel des plateformes connectables. | ||
| + | |||
| + | <code prisma> | ||
| + | model Channel { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | channelType | ||
| + | |||
| + | active | ||
| + | |||
| + | apiDocumentationUrl | ||
| + | |||
| + | logoUrl | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | connections | ||
| + | |||
| + | distributions | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ChannelType ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ChannelType { | ||
| + | |||
| + | OTA | ||
| + | |||
| + | DIRECT | ||
| + | |||
| + | PARTNER | ||
| + | |||
| + | API | ||
| + | |||
| + | MARKETPLACE | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Valeurs initiales ===== | ||
| + | |||
| + | < | ||
| + | AIRBNB | ||
| + | |||
| + | BOOKING | ||
| + | |||
| + | VRBO | ||
| + | |||
| + | ABRITEL | ||
| + | |||
| + | EXPEDIA | ||
| + | |||
| + | DIRECT_WEBSITE | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ChannelConnection ====== | ||
| + | |||
| + | ===== Connexion OTA ===== | ||
| + | |||
| + | Une agence peut posséder plusieurs connexions. | ||
| + | |||
| + | <code prisma> | ||
| + | model ChannelConnection { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | channelId | ||
| + | |||
| + | connectionName | ||
| + | |||
| + | accountIdentifier | ||
| + | |||
| + | apiKey | ||
| + | |||
| + | apiSecret | ||
| + | |||
| + | refreshToken | ||
| + | |||
| + | configuration | ||
| + | |||
| + | active | ||
| + | |||
| + | lastSyncAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | channel | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | propertyDistributions PropertyDistribution[] | ||
| + | |||
| + | syncExecutions | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([channelId]) | ||
| + | |||
| + | @@index([active]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyDistribution ====== | ||
| + | |||
| + | ===== Publication d'un bien ===== | ||
| + | |||
| + | Permet d' | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyDistribution { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | channelId | ||
| + | |||
| + | channelConnectionId | ||
| + | |||
| + | externalPropertyId | ||
| + | |||
| + | externalListingId | ||
| + | |||
| + | published | ||
| + | |||
| + | publicationStatus | ||
| + | |||
| + | publishedAt | ||
| + | |||
| + | lastSyncAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | channel | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | channelConnection | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | reservations | ||
| + | |||
| + | @@unique([ | ||
| + | propertyId, | ||
| + | channelConnectionId | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([channelId]) | ||
| + | |||
| + | @@index([publicationStatus]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== DistributionStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum DistributionStatus { | ||
| + | |||
| + | DRAFT | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | PUBLISHED | ||
| + | |||
| + | SUSPENDED | ||
| + | |||
| + | ERROR | ||
| + | |||
| + | ARCHIVED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ChannelReservation ====== | ||
| + | |||
| + | ===== Réservation OTA ===== | ||
| + | |||
| + | Historise le lien entre la réservation interne et la réservation OTA. | ||
| + | |||
| + | <code prisma> | ||
| + | model ChannelReservation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | propertyDistributionId String | ||
| + | |||
| + | externalReservationId String | ||
| + | |||
| + | externalStatus | ||
| + | |||
| + | importedAt | ||
| + | |||
| + | lastSyncAt | ||
| + | |||
| + | reservation | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | propertyDistribution | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | propertyDistributionId, | ||
| + | externalReservationId | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([reservationId]) | ||
| + | |||
| + | @@index([importedAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== SyncExecution ====== | ||
| + | |||
| + | ===== Historique des synchronisations ===== | ||
| + | |||
| + | Chaque synchronisation OTA doit être historisée. | ||
| + | |||
| + | <code prisma> | ||
| + | model SyncExecution { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | channelConnectionId | ||
| + | |||
| + | syncType | ||
| + | |||
| + | status | ||
| + | |||
| + | startedAt | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | processedCount | ||
| + | |||
| + | successCount | ||
| + | |||
| + | errorCount | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | channelConnection | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | errors | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([channelConnectionId]) | ||
| + | |||
| + | @@index([syncType]) | ||
| + | |||
| + | @@index([status]) | ||
| + | |||
| + | @@index([startedAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== SyncType ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum SyncType { | ||
| + | |||
| + | PROPERTY_EXPORT | ||
| + | |||
| + | AVAILABILITY_EXPORT | ||
| + | |||
| + | RATE_EXPORT | ||
| + | |||
| + | RESERVATION_IMPORT | ||
| + | |||
| + | FULL_SYNC | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== SyncStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum SyncStatus { | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | RUNNING | ||
| + | |||
| + | COMPLETED | ||
| + | |||
| + | PARTIAL_SUCCESS | ||
| + | |||
| + | FAILED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== SyncError ====== | ||
| + | |||
| + | ===== Gestion des erreurs ===== | ||
| + | |||
| + | Permet d' | ||
| + | |||
| + | <code prisma> | ||
| + | model SyncError { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | syncExecutionId | ||
| + | |||
| + | errorCode | ||
| + | |||
| + | errorMessage | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | payload | ||
| + | |||
| + | occurredAt | ||
| + | |||
| + | syncExecution | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([syncExecutionId]) | ||
| + | |||
| + | @@index([errorCode]) | ||
| + | |||
| + | @@index([occurredAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Relations à ajouter ====== | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | <code prisma> | ||
| + | channelConnections ChannelConnection[] | ||
| + | |||
| + | propertyDistributions PropertyDistribution[] | ||
| + | |||
| + | channelReservations ChannelReservation[] | ||
| + | |||
| + | syncExecutions SyncExecution[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Property ===== | ||
| + | |||
| + | <code prisma> | ||
| + | propertyDistributions PropertyDistribution[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Reservation ===== | ||
| + | |||
| + | <code prisma> | ||
| + | channelReservations ChannelReservation[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Synchronisations couvertes ====== | ||
| + | |||
| + | ===== Disponibilités ===== | ||
| + | |||
| + | < | ||
| + | PropertyAvailability | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | OTA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Tarifs ===== | ||
| + | |||
| + | < | ||
| + | PropertyRate | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | OTA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Réservations ===== | ||
| + | |||
| + | < | ||
| + | OTA | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ChannelReservation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Reservation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Publication ===== | ||
| + | |||
| + | < | ||
| + | Property | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | PropertyDistribution | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Airbnb | ||
| + | |||
| + | Booking | ||
| + | |||
| + | Vrbo | ||
| + | |||
| + | Abritel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name ota_channel_manager | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== Sprint 12 ===== | ||
| + | |||
| + | < | ||
| + | Publication OTA | ||
| + | |||
| + | Synchronisation calendrier | ||
| + | |||
| + | Synchronisation tarifs | ||
| + | |||
| + | Import réservations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sprint 14 ===== | ||
| + | |||
| + | < | ||
| + | Partenaires | ||
| + | |||
| + | API externes | ||
| + | |||
| + | Marketplace | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sprint 18 ===== | ||
| + | |||
| + | < | ||
| + | Channel Manager Enterprise | ||
| + | |||
| + | Multi-OTA | ||
| + | |||
| + | Monitoring synchronisations | ||
| + | |||
| + | Gestion erreurs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État du schéma ====== | ||
| + | |||
| + | Après Phase 2-J : | ||
| + | |||
| + | < | ||
| + | ≈ 80 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | avec les domaines : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | |||
| + | OTA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 2-K — Revenue Management & Tarification Dynamique ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire le moteur de Revenue Management de la plateforme. | ||
| + | |||
| + | Ce domaine permettra : | ||
| + | |||
| + | | ||
| + | * Yield Management | ||
| + | * Prévisions de revenus | ||
| + | * Analyse de la demande | ||
| + | * Analyse concurrentielle | ||
| + | * Optimisation automatique des prix | ||
| + | * Simulation financière | ||
| + | * Aide à la décision | ||
| + | |||
| + | Cette phase couvre : | ||
| + | |||
| + | < | ||
| + | Sprint 10 — Reporting | ||
| + | |||
| + | Sprint 13 — IA & Prévisions | ||
| + | |||
| + | Sprint 17 — Revenue Management | ||
| + | |||
| + | Sprint 20 — Enterprise Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| + | |||
| + | < | ||
| + | PricingRule | ||
| + | |||
| + | DynamicPrice | ||
| + | |||
| + | RevenueForecast | ||
| + | |||
| + | RevenueSimulation | ||
| + | |||
| + | CompetitorSnapshot | ||
| + | |||
| + | MarketDemand | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PricingRule ====== | ||
| + | |||
| + | ===== Règle tarifaire ===== | ||
| + | |||
| + | Définit les règles d' | ||
| + | |||
| + | <code prisma> | ||
| + | model PricingRule { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | priority | ||
| + | |||
| + | active | ||
| + | |||
| + | conditions | ||
| + | |||
| + | actions | ||
| + | |||
| + | validFrom | ||
| + | |||
| + | validTo | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([tenantId, | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([active]) | ||
| + | |||
| + | @@index([priority]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Occupation > 80% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | +15% | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | Weekend | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | +10% | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | Haute saison | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | +25% | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== DynamicPrice ====== | ||
| + | |||
| + | ===== Prix calculé ===== | ||
| + | |||
| + | Prix final appliqué à une date donnée. | ||
| + | |||
| + | <code prisma> | ||
| + | model DynamicPrice { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | pricingDate | ||
| + | |||
| + | basePrice | ||
| + | |||
| + | adjustedPrice | ||
| + | |||
| + | occupancyFactor | ||
| + | |||
| + | seasonalityFactor | ||
| + | |||
| + | demandFactor | ||
| + | |||
| + | competitorFactor | ||
| + | |||
| + | generatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | propertyId, | ||
| + | pricingDate | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([pricingDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== RevenueForecast ====== | ||
| + | |||
| + | ===== Prévisions ===== | ||
| + | |||
| + | Prévision de revenus futurs. | ||
| + | |||
| + | <code prisma> | ||
| + | model RevenueForecast { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | forecastDate | ||
| + | |||
| + | forecastPeriodStart | ||
| + | |||
| + | forecastPeriodEnd | ||
| + | |||
| + | expectedRevenue | ||
| + | |||
| + | expectedOccupancy | ||
| + | |||
| + | confidenceLevel | ||
| + | |||
| + | modelVersion | ||
| + | |||
| + | generatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([forecastDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== RevenueSimulation ====== | ||
| + | |||
| + | ===== Simulation ===== | ||
| + | |||
| + | Analyse de scénarios. | ||
| + | |||
| + | <code prisma> | ||
| + | model RevenueSimulation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | name String | ||
| + | |||
| + | assumptions | ||
| + | |||
| + | projectedRevenue | ||
| + | |||
| + | projectedOccupancy | ||
| + | |||
| + | createdByUserId | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | createdByUser | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | Prix +10% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Occupation -3% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CA +6% | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== CompetitorSnapshot ====== | ||
| + | |||
| + | ===== Veille concurrentielle ===== | ||
| + | |||
| + | Capture des prix concurrents. | ||
| + | |||
| + | <code prisma> | ||
| + | model CompetitorSnapshot { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | competitorName | ||
| + | |||
| + | competitorPropertyId | ||
| + | |||
| + | snapshotDate | ||
| + | |||
| + | nightlyRate | ||
| + | |||
| + | occupancy | ||
| + | |||
| + | source | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([snapshotDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== MarketDemand ====== | ||
| + | |||
| + | ===== Indicateurs marché ===== | ||
| + | |||
| + | Mesure de la demande. | ||
| + | |||
| + | <code prisma> | ||
| + | model MarketDemand { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | regionCode | ||
| + | |||
| + | demandDate | ||
| + | |||
| + | demandIndex | ||
| + | |||
| + | occupancyIndex | ||
| + | |||
| + | averageDailyRate | ||
| + | |||
| + | source | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([regionCode]) | ||
| + | |||
| + | @@index([demandDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Relations à ajouter ====== | ||
| + | |||
| + | ===== Property ===== | ||
| + | |||
| + | <code prisma> | ||
| + | pricingRules PricingRule[] | ||
| + | |||
| + | dynamicPrices DynamicPrice[] | ||
| + | |||
| + | revenueForecasts RevenueForecast[] | ||
| + | |||
| + | revenueSimulations RevenueSimulation[] | ||
| + | |||
| + | competitorSnapshots CompetitorSnapshot[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | <code prisma> | ||
| + | pricingRules PricingRule[] | ||
| + | |||
| + | dynamicPrices DynamicPrice[] | ||
| + | |||
| + | revenueForecasts RevenueForecast[] | ||
| + | |||
| + | revenueSimulations RevenueSimulation[] | ||
| + | |||
| + | marketDemands MarketDemand[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Cas d' | ||
| + | |||
| + | ===== Tarification dynamique ===== | ||
| + | |||
| + | < | ||
| + | Occupation | ||
| + | |||
| + | + | ||
| + | |||
| + | Saisonnalité | ||
| + | |||
| + | + | ||
| + | |||
| + | Concurrence | ||
| + | |||
| + | + | ||
| + | |||
| + | Demande | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Prix optimal | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prévision ===== | ||
| + | |||
| + | < | ||
| + | Historique réservations | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Forecast IA | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Revenus prévus | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Simulation ===== | ||
| + | |||
| + | < | ||
| + | Nouveau tarif | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Simulation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Impact CA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name revenue_management | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== Revenue Management ===== | ||
| + | |||
| + | < | ||
| + | Yield Management | ||
| + | |||
| + | Dynamic Pricing | ||
| + | |||
| + | Optimisation tarifaire | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Analytics ===== | ||
| + | |||
| + | < | ||
| + | Forecast | ||
| + | |||
| + | Simulation | ||
| + | |||
| + | Benchmark concurrence | ||
| + | |||
| + | Demand Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== IA ===== | ||
| + | |||
| + | < | ||
| + | Aide à la décision | ||
| + | |||
| + | Prévisions | ||
| + | |||
| + | Recommandations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État du schéma ====== | ||
| + | |||
| + | Après Phase 2-K : | ||
| + | |||
| + | < | ||
| + | ≈ 86 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | avec les domaines : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | |||
| + | OTA | ||
| + | |||
| + | Revenue Management | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 2-L — Sécurité Enterprise & Conformité ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire la couche Enterprise de sécurité, conformité et gouvernance des données. | ||
| + | |||
| + | Cette phase permettra : | ||
| + | |||
| + | * Conformité RGPD | ||
| + | * Gestion des consentements | ||
| + | * Gestion des risques | ||
| + | * Gouvernance des données | ||
| + | * Classification des données | ||
| + | * Rétention réglementaire | ||
| + | * Gestion des incidents de sécurité | ||
| + | * Préparation ISO 27001 | ||
| + | * Préparation SOC2 | ||
| + | * Préparation NIS2 | ||
| + | |||
| + | Cette phase couvre : | ||
| + | |||
| + | < | ||
| + | Sprint 19 | ||
| + | |||
| + | Governance | ||
| + | |||
| + | Compliance | ||
| + | |||
| + | Enterprise Security | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| + | |||
| + | < | ||
| + | Consent | ||
| + | |||
| + | SecurityPolicy | ||
| + | |||
| + | Risk | ||
| + | |||
| + | ComplianceAudit | ||
| + | |||
| + | SecurityIncident | ||
| + | |||
| + | DataClassification | ||
| + | |||
| + | RetentionPolicy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Consent ====== | ||
| + | |||
| + | ===== Gestion des consentements ===== | ||
| + | |||
| + | Traçabilité complète des consentements utilisateurs. | ||
| + | |||
| + | <code prisma> | ||
| + | model Consent { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | customerId | ||
| + | |||
| + | userId | ||
| + | |||
| + | consentType | ||
| + | |||
| + | granted | ||
| + | |||
| + | version | ||
| + | |||
| + | source | ||
| + | |||
| + | ipAddress | ||
| + | |||
| + | userAgent | ||
| + | |||
| + | grantedAt | ||
| + | |||
| + | revokedAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | customer | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | user User? @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([customerId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | |||
| + | @@index([consentType]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ConsentType ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ConsentType { | ||
| + | |||
| + | GDPR | ||
| + | |||
| + | COOKIES | ||
| + | |||
| + | MARKETING_EMAIL | ||
| + | |||
| + | MARKETING_SMS | ||
| + | |||
| + | PROFILING | ||
| + | |||
| + | THIRD_PARTY_SHARING | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== SecurityPolicy ====== | ||
| + | |||
| + | ===== Politiques de sécurité ===== | ||
| + | |||
| + | Configuration centralisée. | ||
| + | |||
| + | <code prisma> | ||
| + | model SecurityPolicy { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | configuration | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([active]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | PASSWORD_POLICY | ||
| + | |||
| + | SESSION_POLICY | ||
| + | |||
| + | MFA_POLICY | ||
| + | |||
| + | RETENTION_POLICY | ||
| + | |||
| + | ACCESS_CONTROL_POLICY | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Risk ====== | ||
| + | |||
| + | ===== Registre des risques ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Risk { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | category | ||
| + | |||
| + | probability | ||
| + | |||
| + | impact | ||
| + | |||
| + | score Int | ||
| + | |||
| + | mitigationPlan | ||
| + | |||
| + | ownerUserId | ||
| + | |||
| + | status | ||
| + | |||
| + | identifiedAt | ||
| + | |||
| + | reviewedAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | ownerUser | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([tenantId, | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | |||
| + | @@index([score]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== RiskCategory ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum RiskCategory { | ||
| + | |||
| + | SECURITY | ||
| + | |||
| + | COMPLIANCE | ||
| + | |||
| + | OPERATIONAL | ||
| + | |||
| + | FINANCIAL | ||
| + | |||
| + | LEGAL | ||
| + | |||
| + | TECHNICAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== RiskStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum RiskStatus { | ||
| + | |||
| + | IDENTIFIED | ||
| + | |||
| + | ASSESSED | ||
| + | |||
| + | MITIGATED | ||
| + | |||
| + | ACCEPTED | ||
| + | |||
| + | CLOSED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ComplianceAudit ====== | ||
| + | |||
| + | ===== Audits réglementaires ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ComplianceAudit { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | auditType | ||
| + | |||
| + | scope | ||
| + | |||
| + | status | ||
| + | |||
| + | auditor | ||
| + | |||
| + | findings | ||
| + | |||
| + | recommendations | ||
| + | |||
| + | startedAt | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([auditType]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ComplianceAuditType ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ComplianceAuditType { | ||
| + | |||
| + | GDPR | ||
| + | |||
| + | ISO27001 | ||
| + | |||
| + | SOC2 | ||
| + | |||
| + | NIS2 | ||
| + | |||
| + | INTERNAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ComplianceAuditStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ComplianceAuditStatus { | ||
| + | |||
| + | PLANNED | ||
| + | |||
| + | RUNNING | ||
| + | |||
| + | COMPLETED | ||
| + | |||
| + | CLOSED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== SecurityIncident ====== | ||
| + | |||
| + | ===== Gestion des incidents ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model SecurityIncident { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | severity | ||
| + | |||
| + | status | ||
| + | |||
| + | detectedAt | ||
| + | |||
| + | resolvedAt | ||
| + | |||
| + | reportedByUserId | ||
| + | |||
| + | rootCause | ||
| + | |||
| + | correctiveActions | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | reportedByUser | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([tenantId, | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([severity]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== IncidentSeverity ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum IncidentSeverity { | ||
| + | |||
| + | LOW | ||
| + | |||
| + | MEDIUM | ||
| + | |||
| + | HIGH | ||
| + | |||
| + | CRITICAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== IncidentStatus ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum IncidentStatus { | ||
| + | |||
| + | OPEN | ||
| + | |||
| + | INVESTIGATING | ||
| + | |||
| + | MITIGATED | ||
| + | |||
| + | RESOLVED | ||
| + | |||
| + | CLOSED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== DataClassification ====== | ||
| + | |||
| + | ===== Classification des données ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model DataClassification { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | level | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ClassificationLevel ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ClassificationLevel { | ||
| + | |||
| + | PUBLIC | ||
| + | |||
| + | INTERNAL | ||
| + | |||
| + | CONFIDENTIAL | ||
| + | |||
| + | RESTRICTED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Client | ||
| + | |||
| + | → CONFIDENTIAL | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | Paiement | ||
| + | |||
| + | → RESTRICTED | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | Catalogue public | ||
| + | |||
| + | → PUBLIC | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== RetentionPolicy ====== | ||
| + | |||
| + | ===== Politique de conservation ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model RetentionPolicy { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | entityType | ||
| + | |||
| + | retentionDays | ||
| + | |||
| + | archiveBeforeDelete | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([entityType]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | AuditLog | ||
| + | |||
| + | 3650 jours | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | LoginHistory | ||
| + | |||
| + | 365 jours | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | MarketingEvent | ||
| + | |||
| + | 1095 jours | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | Consent | ||
| + | |||
| + | 1825 jours | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Relations à ajouter ====== | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | <code prisma> | ||
| + | consents Consent[] | ||
| + | |||
| + | securityPolicies SecurityPolicy[] | ||
| + | |||
| + | risks Risk[] | ||
| + | |||
| + | complianceAudits ComplianceAudit[] | ||
| + | |||
| + | securityIncidents SecurityIncident[] | ||
| + | |||
| + | retentionPolicies RetentionPolicy[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== User ===== | ||
| + | |||
| + | <code prisma> | ||
| + | consents Consent[] | ||
| + | |||
| + | ownedRisks Risk[] | ||
| + | |||
| + | reportedIncidents SecurityIncident[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Customer ===== | ||
| + | |||
| + | <code prisma> | ||
| + | consents Consent[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name enterprise_security_compliance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== RGPD ===== | ||
| + | |||
| + | < | ||
| + | Consentements | ||
| + | |||
| + | Traçabilité | ||
| + | |||
| + | Conservation | ||
| + | |||
| + | Export | ||
| + | |||
| + | Suppression | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sécurité ===== | ||
| + | |||
| + | < | ||
| + | Politiques | ||
| + | |||
| + | Incidents | ||
| + | |||
| + | MFA | ||
| + | |||
| + | Gestion des risques | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Gouvernance | ||
| + | |||
| + | < | ||
| + | Classification | ||
| + | |||
| + | Rétention | ||
| + | |||
| + | Audit | ||
| + | |||
| + | Conformité | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État du schéma ====== | ||
| + | |||
| + | Après Phase 2-L : | ||
| + | |||
| + | < | ||
| + | ≈ 93 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | avec les domaines : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | |||
| + | OTA | ||
| + | |||
| + | Revenue Management | ||
| + | |||
| + | Enterprise Security | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 2-M — Internationalisation & Multi-régions ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Transformer la plateforme en solution SaaS internationale capable de gérer : | ||
| + | |||
| + | * Plusieurs langues | ||
| + | * Plusieurs devises | ||
| + | * Plusieurs pays | ||
| + | * Plusieurs fuseaux horaires | ||
| + | * Plusieurs régions d' | ||
| + | * Plusieurs marques | ||
| + | * Plusieurs réseaux d' | ||
| + | * Plusieurs juridictions | ||
| + | |||
| + | Cette phase couvre : | ||
| + | |||
| + | < | ||
| + | Sprint 15 — Réseau d' | ||
| + | |||
| + | Sprint 20 — Internationalisation | ||
| + | |||
| + | Enterprise SaaS | ||
| + | |||
| + | Commercialisation internationale | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| + | |||
| + | < | ||
| + | Country | ||
| + | |||
| + | Currency | ||
| + | |||
| + | Language | ||
| + | |||
| + | Timezone | ||
| + | |||
| + | CurrencyRate | ||
| + | |||
| + | Translation | ||
| + | |||
| + | Region | ||
| + | |||
| + | EnterpriseLicense | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Country ====== | ||
| + | |||
| + | ===== Référentiel pays ===== | ||
| + | |||
| + | Norme ISO 3166. | ||
| + | |||
| + | <code prisma> | ||
| + | model Country { | ||
| + | |||
| + | code String @id | ||
| + | |||
| + | iso3 String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | nativeName | ||
| + | |||
| + | phonePrefix | ||
| + | |||
| + | euMember | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | regions | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | FR | ||
| + | |||
| + | BE | ||
| + | |||
| + | CH | ||
| + | |||
| + | ES | ||
| + | |||
| + | IT | ||
| + | |||
| + | DE | ||
| + | |||
| + | UK | ||
| + | |||
| + | US | ||
| + | |||
| + | CA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Currency ====== | ||
| + | |||
| + | ===== Référentiel devises ===== | ||
| + | |||
| + | Norme ISO 4217. | ||
| + | |||
| + | <code prisma> | ||
| + | model Currency { | ||
| + | |||
| + | code String @id | ||
| + | |||
| + | numericCode | ||
| + | |||
| + | name String | ||
| + | |||
| + | symbol | ||
| + | |||
| + | decimalPlaces | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | rates | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | EUR | ||
| + | |||
| + | USD | ||
| + | |||
| + | GBP | ||
| + | |||
| + | CHF | ||
| + | |||
| + | CAD | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Language ====== | ||
| + | |||
| + | ===== Référentiel langues ===== | ||
| + | |||
| + | Norme ISO 639. | ||
| + | |||
| + | <code prisma> | ||
| + | model Language { | ||
| + | |||
| + | code String @id | ||
| + | |||
| + | name String | ||
| + | |||
| + | nativeName | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | translations | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | fr | ||
| + | |||
| + | en | ||
| + | |||
| + | de | ||
| + | |||
| + | es | ||
| + | |||
| + | it | ||
| + | |||
| + | nl | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Timezone ====== | ||
| + | |||
| + | ===== Fuseaux horaires ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Timezone { | ||
| + | |||
| + | id String @id | ||
| + | |||
| + | displayName | ||
| + | |||
| + | utcOffset | ||
| + | |||
| + | active | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Europe/ | ||
| + | |||
| + | Europe/ | ||
| + | |||
| + | America/ | ||
| + | |||
| + | America/ | ||
| + | |||
| + | Asia/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== CurrencyRate ====== | ||
| + | |||
| + | ===== Taux de change ===== | ||
| + | |||
| + | Historisation des taux. | ||
| + | |||
| + | <code prisma> | ||
| + | model CurrencyRate { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | fromCurrencyCode | ||
| + | |||
| + | toCurrencyCode | ||
| + | |||
| + | rate Decimal @db.Decimal(18, | ||
| + | |||
| + | rateDate | ||
| + | |||
| + | source | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | fromCurrency | ||
| + | @relation( | ||
| + | " | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | toCurrency | ||
| + | @relation( | ||
| + | " | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | fromCurrencyCode, | ||
| + | toCurrencyCode, | ||
| + | rateDate | ||
| + | ]) | ||
| + | |||
| + | @@index([rateDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Translation ====== | ||
| + | |||
| + | ===== Traductions ===== | ||
| + | |||
| + | Permet l' | ||
| + | |||
| + | <code prisma> | ||
| + | model Translation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | languageCode | ||
| + | |||
| + | namespace | ||
| + | |||
| + | translationKey | ||
| + | |||
| + | translationValue | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | language | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | languageCode, | ||
| + | namespace, | ||
| + | translationKey | ||
| + | ]) | ||
| + | |||
| + | @@index([namespace]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | property.title | ||
| + | |||
| + | reservation.confirm | ||
| + | |||
| + | payment.invoice | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Region ====== | ||
| + | |||
| + | ===== Régions d' | ||
| + | |||
| + | Permet la gestion géographique. | ||
| + | |||
| + | <code prisma> | ||
| + | model Region { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | countryCode | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | country | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | countryCode, | ||
| + | code | ||
| + | ]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | FR_OCCITANIE | ||
| + | |||
| + | FR_PACA | ||
| + | |||
| + | FR_IDF | ||
| + | |||
| + | ES_CATALUNYA | ||
| + | |||
| + | US_FLORIDA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== EnterpriseLicense ====== | ||
| + | |||
| + | ===== Licence SaaS Enterprise ===== | ||
| + | |||
| + | Gestion des déploiements internationaux. | ||
| + | |||
| + | <code prisma> | ||
| + | model EnterpriseLicense { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | licenseKey | ||
| + | |||
| + | edition | ||
| + | |||
| + | maxUsers | ||
| + | |||
| + | maxProperties | ||
| + | |||
| + | maxAgencies | ||
| + | |||
| + | validFrom | ||
| + | |||
| + | validTo | ||
| + | |||
| + | active | ||
| + | |||
| + | features | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([active]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== EnterpriseEdition ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum EnterpriseEdition { | ||
| + | |||
| + | COMMUNITY | ||
| + | |||
| + | PROFESSIONAL | ||
| + | |||
| + | BUSINESS | ||
| + | |||
| + | ENTERPRISE | ||
| + | |||
| + | ENTERPRISE_PLUS | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Évolutions du modèle Tenant ====== | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | countryCode String? | ||
| + | |||
| + | currencyCode String? | ||
| + | |||
| + | languageCode String? | ||
| + | |||
| + | timezoneId String? | ||
| + | |||
| + | enterpriseLicense EnterpriseLicense? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Relations ===== | ||
| + | |||
| + | <code prisma> | ||
| + | country Country? | ||
| + | |||
| + | currency Currency? | ||
| + | |||
| + | language Language? | ||
| + | |||
| + | timezone Timezone? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Évolutions du modèle Property ====== | ||
| + | |||
| + | ===== Property ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | currencyCode String? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Relation ===== | ||
| + | |||
| + | <code prisma> | ||
| + | currency Currency? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Évolutions du modèle Reservation ====== | ||
| + | |||
| + | ===== Reservation ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | currencyCode String? | ||
| + | exchangeRate Decimal? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Cas d' | ||
| + | |||
| + | ===== Multi-langues ===== | ||
| + | |||
| + | < | ||
| + | FR | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | EN | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | DE | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ES | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Multi-devises ===== | ||
| + | |||
| + | < | ||
| + | EUR | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | USD | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | GBP | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CHF | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Multi-régions ===== | ||
| + | |||
| + | < | ||
| + | France | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Occitanie | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Agence | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Biens | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Réseau international ===== | ||
| + | |||
| + | < | ||
| + | Tenant | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Multi-marques | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Multi-pays | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Multi-régions | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name internationalization_multiregion | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== Internationalisation ===== | ||
| + | |||
| + | < | ||
| + | Multi-langues | ||
| + | |||
| + | Multi-devises | ||
| + | |||
| + | Multi-fuseaux | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Réseau ===== | ||
| + | |||
| + | < | ||
| + | Multi-pays | ||
| + | |||
| + | Multi-régions | ||
| + | |||
| + | Multi-agences | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Enterprise ===== | ||
| + | |||
| + | < | ||
| + | Licensing | ||
| + | |||
| + | Commercialisation | ||
| + | |||
| + | SaaS mondial | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État du schéma ====== | ||
| + | |||
| + | Après Phase 2-M : | ||
| + | |||
| + | < | ||
| + | ≈ 101 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | avec les domaines : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | |||
| + | OTA | ||
| + | |||
| + | Revenue Management | ||
| + | |||
| + | Enterprise Security | ||
| + | |||
| + | Internationalization | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 2-M — Internationalisation & Multi-régions ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Transformer la plateforme en solution SaaS internationale capable de gérer : | ||
| + | |||
| + | * Plusieurs langues | ||
| + | * Plusieurs devises | ||
| + | * Plusieurs pays | ||
| + | * Plusieurs fuseaux horaires | ||
| + | * Plusieurs régions d' | ||
| + | * Plusieurs marques | ||
| + | * Plusieurs réseaux d' | ||
| + | * Plusieurs juridictions | ||
| + | |||
| + | Cette phase couvre : | ||
| + | |||
| + | < | ||
| + | Sprint 15 — Réseau d' | ||
| + | |||
| + | Sprint 20 — Internationalisation | ||
| + | |||
| + | Enterprise SaaS | ||
| + | |||
| + | Commercialisation internationale | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| + | |||
| + | < | ||
| + | Country | ||
| + | |||
| + | Currency | ||
| + | |||
| + | Language | ||
| + | |||
| + | Timezone | ||
| + | |||
| + | CurrencyRate | ||
| + | |||
| + | Translation | ||
| + | |||
| + | Region | ||
| + | |||
| + | EnterpriseLicense | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Country ====== | ||
| + | |||
| + | ===== Référentiel pays ===== | ||
| + | |||
| + | Norme ISO 3166. | ||
| + | |||
| + | <code prisma> | ||
| + | model Country { | ||
| + | |||
| + | code String @id | ||
| + | |||
| + | iso3 String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | nativeName | ||
| + | |||
| + | phonePrefix | ||
| + | |||
| + | euMember | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | regions | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | FR | ||
| + | |||
| + | BE | ||
| + | |||
| + | CH | ||
| + | |||
| + | ES | ||
| + | |||
| + | IT | ||
| + | |||
| + | DE | ||
| + | |||
| + | UK | ||
| + | |||
| + | US | ||
| + | |||
| + | CA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Currency ====== | ||
| + | |||
| + | ===== Référentiel devises ===== | ||
| + | |||
| + | Norme ISO 4217. | ||
| + | |||
| + | <code prisma> | ||
| + | model Currency { | ||
| + | |||
| + | code String @id | ||
| + | |||
| + | numericCode | ||
| + | |||
| + | name String | ||
| + | |||
| + | symbol | ||
| + | |||
| + | decimalPlaces | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | rates | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | EUR | ||
| + | |||
| + | USD | ||
| + | |||
| + | GBP | ||
| + | |||
| + | CHF | ||
| + | |||
| + | CAD | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Language ====== | ||
| + | |||
| + | ===== Référentiel langues ===== | ||
| + | |||
| + | Norme ISO 639. | ||
| + | |||
| + | <code prisma> | ||
| + | model Language { | ||
| + | |||
| + | code String @id | ||
| + | |||
| + | name String | ||
| + | |||
| + | nativeName | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | translations | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | fr | ||
| + | |||
| + | en | ||
| + | |||
| + | de | ||
| + | |||
| + | es | ||
| + | |||
| + | it | ||
| + | |||
| + | nl | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Timezone ====== | ||
| + | |||
| + | ===== Fuseaux horaires ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Timezone { | ||
| + | |||
| + | id String @id | ||
| + | |||
| + | displayName | ||
| + | |||
| + | utcOffset | ||
| + | |||
| + | active | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Europe/ | ||
| + | |||
| + | Europe/ | ||
| + | |||
| + | America/ | ||
| + | |||
| + | America/ | ||
| + | |||
| + | Asia/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== CurrencyRate ====== | ||
| + | |||
| + | ===== Taux de change ===== | ||
| + | |||
| + | Historisation des taux. | ||
| + | |||
| + | <code prisma> | ||
| + | model CurrencyRate { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | fromCurrencyCode | ||
| + | |||
| + | toCurrencyCode | ||
| + | |||
| + | rate Decimal @db.Decimal(18, | ||
| + | |||
| + | rateDate | ||
| + | |||
| + | source | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | fromCurrency | ||
| + | @relation( | ||
| + | " | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | toCurrency | ||
| + | @relation( | ||
| + | " | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | fromCurrencyCode, | ||
| + | toCurrencyCode, | ||
| + | rateDate | ||
| + | ]) | ||
| + | |||
| + | @@index([rateDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Translation ====== | ||
| + | |||
| + | ===== Traductions ===== | ||
| + | |||
| + | Permet l' | ||
| + | |||
| + | <code prisma> | ||
| + | model Translation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | languageCode | ||
| + | |||
| + | namespace | ||
| + | |||
| + | translationKey | ||
| + | |||
| + | translationValue | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | language | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | languageCode, | ||
| + | namespace, | ||
| + | translationKey | ||
| + | ]) | ||
| + | |||
| + | @@index([namespace]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | property.title | ||
| + | |||
| + | reservation.confirm | ||
| + | |||
| + | payment.invoice | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Region ====== | ||
| + | |||
| + | ===== Régions d' | ||
| + | |||
| + | Permet la gestion géographique. | ||
| + | |||
| + | <code prisma> | ||
| + | model Region { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | countryCode | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | country | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | countryCode, | ||
| + | code | ||
| + | ]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | FR_OCCITANIE | ||
| + | |||
| + | FR_PACA | ||
| + | |||
| + | FR_IDF | ||
| + | |||
| + | ES_CATALUNYA | ||
| + | |||
| + | US_FLORIDA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== EnterpriseLicense ====== | ||
| + | |||
| + | ===== Licence SaaS Enterprise ===== | ||
| + | |||
| + | Gestion des déploiements internationaux. | ||
| + | |||
| + | <code prisma> | ||
| + | model EnterpriseLicense { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | licenseKey | ||
| + | |||
| + | edition | ||
| + | |||
| + | maxUsers | ||
| + | |||
| + | maxProperties | ||
| + | |||
| + | maxAgencies | ||
| + | |||
| + | validFrom | ||
| + | |||
| + | validTo | ||
| + | |||
| + | active | ||
| + | |||
| + | features | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([active]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== EnterpriseEdition ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum EnterpriseEdition { | ||
| + | |||
| + | COMMUNITY | ||
| + | |||
| + | PROFESSIONAL | ||
| + | |||
| + | BUSINESS | ||
| + | |||
| + | ENTERPRISE | ||
| + | |||
| + | ENTERPRISE_PLUS | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Évolutions du modèle Tenant ====== | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | countryCode String? | ||
| + | |||
| + | currencyCode String? | ||
| + | |||
| + | languageCode String? | ||
| + | |||
| + | timezoneId String? | ||
| + | |||
| + | enterpriseLicense EnterpriseLicense? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Relations ===== | ||
| + | |||
| + | <code prisma> | ||
| + | country Country? | ||
| + | |||
| + | currency Currency? | ||
| + | |||
| + | language Language? | ||
| + | |||
| + | timezone Timezone? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Évolutions du modèle Property ====== | ||
| + | |||
| + | ===== Property ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | currencyCode String? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Relation ===== | ||
| + | |||
| + | <code prisma> | ||
| + | currency Currency? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Évolutions du modèle Reservation ====== | ||
| + | |||
| + | ===== Reservation ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | currencyCode String? | ||
| + | exchangeRate Decimal? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Cas d' | ||
| + | |||
| + | ===== Multi-langues ===== | ||
| + | |||
| + | < | ||
| + | FR | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | EN | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | DE | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ES | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Multi-devises ===== | ||
| + | |||
| + | < | ||
| + | EUR | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | USD | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | GBP | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CHF | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Multi-régions ===== | ||
| + | |||
| + | < | ||
| + | France | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Occitanie | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Agence | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Biens | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Réseau international ===== | ||
| + | |||
| + | < | ||
| + | Tenant | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Multi-marques | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Multi-pays | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Multi-régions | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name internationalization_multiregion | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== Internationalisation ===== | ||
| + | |||
| + | < | ||
| + | Multi-langues | ||
| + | |||
| + | Multi-devises | ||
| + | |||
| + | Multi-fuseaux | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Réseau ===== | ||
| + | |||
| + | < | ||
| + | Multi-pays | ||
| + | |||
| + | Multi-régions | ||
| + | |||
| + | Multi-agences | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Enterprise ===== | ||
| + | |||
| + | < | ||
| + | Licensing | ||
| + | |||
| + | Commercialisation | ||
| + | |||
| + | SaaS mondial | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État du schéma ====== | ||
| + | |||
| + | Après Phase 2-M : | ||
| + | |||
| + | < | ||
| + | ≈ 101 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | avec les domaines : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | |||
| + | OTA | ||
| + | |||
| + | Revenue Management | ||
| + | |||
| + | Enterprise Security | ||
| + | |||
| + | Internationalization | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 2-N — IA, Knowledge Base & Automatisation Avancée ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire la couche d' | ||
| + | |||
| + | Cette couche permettra : | ||
| + | |||
| + | * Assistant IA interne | ||
| + | * Recherche sémantique | ||
| + | * Base de connaissances | ||
| + | * Recommandations intelligentes | ||
| + | * Analyse documentaire | ||
| + | * Automatisation avancée | ||
| + | * Aide à la décision | ||
| + | * Support opérationnel | ||
| + | |||
| + | Cette phase finalise : | ||
| + | |||
| + | < | ||
| + | Sprint 13 — IA & Automatisation | ||
| + | |||
| + | Sprint 20 — Enterprise Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture ====== | ||
| + | |||
| + | ===== Modèles ===== | ||
| + | |||
| + | < | ||
| + | AiConversation | ||
| + | |||
| + | AiMessage | ||
| + | |||
| + | KnowledgeDocument | ||
| + | |||
| + | KnowledgeChunk | ||
| + | |||
| + | AutomationScenario | ||
| + | |||
| + | AutomationExecution | ||
| + | |||
| + | Recommendation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== AiConversation ====== | ||
| + | |||
| + | ===== Conversations IA ===== | ||
| + | |||
| + | Historisation des échanges avec l' | ||
| + | |||
| + | <code prisma> | ||
| + | model AiConversation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | userId | ||
| + | |||
| + | title | ||
| + | |||
| + | modelName | ||
| + | |||
| + | contextType | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | user User @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | messages | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | |||
| + | @@index([createdAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Analyse réservations | ||
| + | |||
| + | Prévision revenus | ||
| + | |||
| + | Recherche client | ||
| + | |||
| + | Analyse contrat | ||
| + | |||
| + | Support utilisateur | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== AiMessage ====== | ||
| + | |||
| + | ===== Messages IA ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model AiMessage { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | conversationId | ||
| + | |||
| + | role AiRole | ||
| + | |||
| + | content | ||
| + | |||
| + | tokenCount | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | conversation | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([conversationId]) | ||
| + | |||
| + | @@index([createdAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== AiRole ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum AiRole { | ||
| + | |||
| + | SYSTEM | ||
| + | |||
| + | USER | ||
| + | |||
| + | ASSISTANT | ||
| + | |||
| + | TOOL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== KnowledgeDocument ====== | ||
| + | |||
| + | ===== Base documentaire ===== | ||
| + | |||
| + | Documents utilisés par l' | ||
| + | |||
| + | <code prisma> | ||
| + | model KnowledgeDocument { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | documentId | ||
| + | |||
| + | title | ||
| + | |||
| + | sourceType | ||
| + | |||
| + | sourceReference | ||
| + | |||
| + | content | ||
| + | |||
| + | metadata | ||
| + | |||
| + | indexed | ||
| + | |||
| + | indexedAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | document | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | chunks | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([indexed]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== KnowledgeSourceType ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum KnowledgeSourceType { | ||
| + | |||
| + | DOCUMENT | ||
| + | |||
| + | CONTRACT | ||
| + | |||
| + | FAQ | ||
| + | |||
| + | WEBSITE | ||
| + | |||
| + | POLICY | ||
| + | |||
| + | PROCEDURE | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== KnowledgeChunk ====== | ||
| + | |||
| + | ===== Découpage vectoriel ===== | ||
| + | |||
| + | Préparation RAG. | ||
| + | |||
| + | <code prisma> | ||
| + | model KnowledgeChunk { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | knowledgeDocumentId | ||
| + | |||
| + | chunkIndex | ||
| + | |||
| + | content | ||
| + | |||
| + | embeddingId | ||
| + | |||
| + | metadata | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | knowledgeDocument | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | knowledgeDocumentId, | ||
| + | chunkIndex | ||
| + | ]) | ||
| + | |||
| + | @@index([knowledgeDocumentId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== AutomationScenario ====== | ||
| + | |||
| + | ===== Automatisations avancées ===== | ||
| + | |||
| + | Version métier évoluée de : | ||
| + | |||
| + | < | ||
| + | AutomationRule | ||
| + | </ | ||
| + | |||
| + | <code prisma> | ||
| + | model AutomationScenario { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | triggerType | ||
| + | |||
| + | configuration | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | executions | ||
| + | |||
| + | @@unique([tenantId, | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([active]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | ReservationConfirmed | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | SendContract | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CreateTask | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | NotifyOwner | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | PaymentReceived | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | GenerateInvoice | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | NotifyCustomer | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== AutomationExecution ====== | ||
| + | |||
| + | ===== Historique d' | ||
| + | |||
| + | Extension du modèle existant. | ||
| + | |||
| + | <code prisma> | ||
| + | model AutomationExecution { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | automationScenarioId | ||
| + | |||
| + | automationRuleId | ||
| + | |||
| + | status | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | executionContext | ||
| + | |||
| + | startedAt | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | errorMessage | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | automationScenario | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | automationRule | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([automationScenarioId]) | ||
| + | |||
| + | @@index([automationRuleId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Recommendation ====== | ||
| + | |||
| + | ===== Recommandations IA ===== | ||
| + | |||
| + | Aide à la décision. | ||
| + | |||
| + | <code prisma> | ||
| + | model Recommendation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | recommendationType | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | confidenceScore | ||
| + | |||
| + | accepted | ||
| + | |||
| + | acceptedAt | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([entityType]) | ||
| + | |||
| + | @@index([recommendationType]) | ||
| + | |||
| + | @@index([confidenceScore]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== RecommendationType ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum RecommendationType { | ||
| + | |||
| + | PRICE_OPTIMIZATION | ||
| + | |||
| + | CUSTOMER_RETENTION | ||
| + | |||
| + | LEAD_CONVERSION | ||
| + | |||
| + | REVENUE_FORECAST | ||
| + | |||
| + | PROPERTY_IMPROVEMENT | ||
| + | |||
| + | RISK_ALERT | ||
| + | |||
| + | AUTOMATION | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Relations à ajouter ====== | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | <code prisma> | ||
| + | aiConversations AiConversation[] | ||
| + | |||
| + | knowledgeDocuments KnowledgeDocument[] | ||
| + | |||
| + | automationScenarios AutomationScenario[] | ||
| + | |||
| + | recommendations Recommendation[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== User ===== | ||
| + | |||
| + | <code prisma> | ||
| + | aiConversations AiConversation[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Document ===== | ||
| + | |||
| + | <code prisma> | ||
| + | knowledgeDocuments KnowledgeDocument[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Cas d' | ||
| + | |||
| + | ===== Assistant Agence ===== | ||
| + | |||
| + | < | ||
| + | "Quels biens sont sous-performants ?" | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Analyse IA | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Recommandations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Assistant Commercial ===== | ||
| + | |||
| + | < | ||
| + | " | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Scoring | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Liste qualifiée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Assistant Revenue ===== | ||
| + | |||
| + | < | ||
| + | " | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Forecast | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Recommandations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Recherche documentaire ===== | ||
| + | |||
| + | < | ||
| + | Question | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | RAG | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | KnowledgeDocument | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | KnowledgeChunk | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Réponse | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name ai_knowledge_automation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fonctionnalités couvertes ====== | ||
| + | |||
| + | ===== IA ===== | ||
| + | |||
| + | < | ||
| + | Assistant conversationnel | ||
| + | |||
| + | Recherche sémantique | ||
| + | |||
| + | Analyse métier | ||
| + | |||
| + | Aide à la décision | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Knowledge Base ===== | ||
| + | |||
| + | < | ||
| + | FAQ | ||
| + | |||
| + | Procédures | ||
| + | |||
| + | Contrats | ||
| + | |||
| + | Documentation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Automatisation ===== | ||
| + | |||
| + | < | ||
| + | Workflows avancés | ||
| + | |||
| + | Scénarios | ||
| + | |||
| + | Actions automatiques | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== État final du schéma ====== | ||
| + | |||
| + | Après Phase 2-N : | ||
| + | |||
| + | < | ||
| + | ≈ 108 à 112 modèles Prisma | ||
| + | </ | ||
| + | |||
| + | répartis sur : | ||
| + | |||
| + | < | ||
| + | Core | ||
| + | |||
| + | Security | ||
| + | |||
| + | RBAC | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | Customers | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | Payments | ||
| + | |||
| + | Accounting | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Messaging | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Automation | ||
| + | |||
| + | Governance | ||
| + | |||
| + | OTA | ||
| + | |||
| + | Revenue Management | ||
| + | |||
| + | Enterprise Security | ||
| + | |||
| + | Internationalization | ||
| + | |||
| + | Artificial Intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fin de la Phase 2 ====== | ||
| + | |||
| + | Le schéma Prisma couvre désormais l' | ||
| + | |||
| + | < | ||
| + | Sprint 1 → Sprint 20 | ||
| + | </ | ||
| + | |||
| + | et constitue la base pour : | ||
| + | |||
| + | < | ||
| + | Phase 3 | ||
| + | |||
| + | OpenAPI 3.1 complet | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | DTO NestJS | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | SDK TypeScript | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Génération Backend NestJS | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Génération Frontend NextJS | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Monorepo Enterprise 4.0 | ||
| + | </ | ||
ujusum/3-codage/1-repository/2-prisma-schema.1780850323.txt.gz · Dernière modification : 2026/06/07 18:38 de 91.170.108.99