ujusum:3-codage:2-sprints:3-sprint-3
Différences
Ci-dessous, les différences entre deux révisions de la page.
| ujusum:3-codage:2-sprints:3-sprint-3 [2026/06/10 02:19] – créée 83.202.252.200 | ujusum:3-codage:2-sprints:3-sprint-3 [2026/06/10 14:39] (Version actuelle) – 83.202.252.200 | ||
|---|---|---|---|
| Ligne 9221: | Ligne 9221: | ||
| CRM Notes API | CRM Notes API | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2 — Collaboration CRM Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Transformer le système de notes CRM en véritable plateforme collaborative Enterprise. | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Threads | ||
| + | |||
| + | ✓ Réponses aux notes | ||
| + | |||
| + | ✓ Réactions | ||
| + | |||
| + | ✓ Tâches liées | ||
| + | |||
| + | ✓ Assignation | ||
| + | |||
| + | ✓ Notifications temps réel | ||
| + | |||
| + | ✓ Timeline CRM unifiée | ||
| + | |||
| + | ✓ Collaboration multi-équipes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CRM Timeline | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Notes | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Threads | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Tasks | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Mentions | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Notifications | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Collaboration Hub | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — Support des Threads ====== | ||
| + | |||
| + | ===== Ajouter dans CustomerNote ===== | ||
| + | |||
| + | <code prisma> | ||
| + | parentNoteId | ||
| + | |||
| + | threadRootId | ||
| + | |||
| + | replyCount | ||
| + | @default(0) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — Relations ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | parentNote CustomerNote? | ||
| + | | ||
| + | " | ||
| + | | ||
| + | | ||
| + | ) | ||
| + | |||
| + | replies CustomerNote[] | ||
| + | @relation( | ||
| + | " | ||
| + | ) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — Réactions ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CustomerNoteReaction { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | noteId | ||
| + | |||
| + | userId | ||
| + | |||
| + | reaction | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | note CustomerNote | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | user User | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | noteId, | ||
| + | userId, | ||
| + | reaction | ||
| + | ]) | ||
| + | |||
| + | @@index([noteId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Tâches CRM ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CustomerTask { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | customerId | ||
| + | |||
| + | noteId | ||
| + | |||
| + | assignedToId | ||
| + | |||
| + | createdById | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | priority | ||
| + | |||
| + | status | ||
| + | |||
| + | dueDate | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([customerId]) | ||
| + | |||
| + | @@index([assignedToId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum TaskPriority { | ||
| + | |||
| + | LOW | ||
| + | |||
| + | MEDIUM | ||
| + | |||
| + | HIGH | ||
| + | |||
| + | CRITICAL | ||
| + | } | ||
| + | |||
| + | enum TaskStatus { | ||
| + | |||
| + | OPEN | ||
| + | |||
| + | IN_PROGRESS | ||
| + | |||
| + | COMPLETED | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name crm_collaboration | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-B ====== | ||
| + | |||
| + | ===== Threads CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Réponses ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | Dans : | ||
| + | |||
| + | < | ||
| + | CustomerNoteService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthode ===== | ||
| + | |||
| + | <code ts> | ||
| + | replyToNote() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Workflow ===== | ||
| + | |||
| + | < | ||
| + | Note | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Réponse | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Thread | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Timeline | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Client VIP | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Note commerciale | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Réponse finance | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Réponse support | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Résultat ===== | ||
| + | |||
| + | < | ||
| + | Conversation CRM unifiée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Lecture Thread ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | < | ||
| + | Arborescence complète | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-C ====== | ||
| + | |||
| + | ===== Réactions ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Réactions supportées ====== | ||
| + | |||
| + | < | ||
| + | LIKE | ||
| + | |||
| + | IMPORTANT | ||
| + | |||
| + | FOLLOW_UP | ||
| + | |||
| + | DONE | ||
| + | |||
| + | WARNING | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Service ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code ts> | ||
| + | addReaction() | ||
| + | |||
| + | removeReaction() | ||
| + | |||
| + | listReactions() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | |||
| + | DELETE / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-D ====== | ||
| + | |||
| + | ===== Assignation CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Assignation ====== | ||
| + | |||
| + | ===== Ajouter dans CustomerNote ===== | ||
| + | |||
| + | <code prisma> | ||
| + | assignedToId String? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Relation ===== | ||
| + | |||
| + | <code prisma> | ||
| + | assignedTo User? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | PUT / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | Client réclame facture | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Assigné Finance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Notification ====== | ||
| + | |||
| + | ===== Déclencher ===== | ||
| + | |||
| + | < | ||
| + | Notification | ||
| + | |||
| + | |||
| + | |||
| + | In-App | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-E ====== | ||
| + | |||
| + | ===== Tâches CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — CustomerTaskService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-task.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | createTask() | ||
| + | |||
| + | assignTask() | ||
| + | |||
| + | completeTask() | ||
| + | |||
| + | cancelTask() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Endpoints ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | PUT / | ||
| + | |||
| + | DELETE / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Rappeler client | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Assigner commercial | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Date limite | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-F ====== | ||
| + | |||
| + | ===== Notifications Temps Réel ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — WebSocket ====== | ||
| + | |||
| + | ===== Réutiliser ===== | ||
| + | |||
| + | Infrastructure : | ||
| + | |||
| + | < | ||
| + | Notification Gateway | ||
| + | </ | ||
| + | |||
| + | prévue en Sprint 9. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Événements ====== | ||
| + | |||
| + | < | ||
| + | NOTE_CREATED | ||
| + | |||
| + | NOTE_REPLY | ||
| + | |||
| + | NOTE_MENTION | ||
| + | |||
| + | NOTE_ASSIGNED | ||
| + | |||
| + | TASK_CREATED | ||
| + | |||
| + | TASK_COMPLETED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Canal ====== | ||
| + | |||
| + | < | ||
| + | tenant: | ||
| + | |||
| + | crm: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-G ====== | ||
| + | |||
| + | ===== Timeline CRM Unifiée ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Création ====== | ||
| + | |||
| + | < | ||
| + | crm-timeline.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sources ===== | ||
| + | |||
| + | < | ||
| + | CustomerNote | ||
| + | |||
| + | CustomerDocument | ||
| + | |||
| + | CustomerTag | ||
| + | |||
| + | CustomerTask | ||
| + | |||
| + | Reservation | ||
| + | |||
| + | Invoice | ||
| + | |||
| + | Communication | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Timeline ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | [ | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Filtres ====== | ||
| + | |||
| + | < | ||
| + | Notes | ||
| + | |||
| + | Documents | ||
| + | |||
| + | Tâches | ||
| + | |||
| + | Tags | ||
| + | |||
| + | Réservations | ||
| + | |||
| + | Factures | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-H ====== | ||
| + | |||
| + | ===== Collaboration Dashboard ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== KPI ===== | ||
| + | |||
| + | < | ||
| + | Notes ouvertes | ||
| + | |||
| + | Tâches ouvertes | ||
| + | |||
| + | Mentions non lues | ||
| + | |||
| + | Assignations | ||
| + | |||
| + | Threads actifs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-I ====== | ||
| + | |||
| + | ===== Audit & Historisation ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — CustomerHistory ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | NOTE_REPLIED | ||
| + | |||
| + | NOTE_ASSIGNED | ||
| + | |||
| + | TASK_CREATED | ||
| + | |||
| + | TASK_COMPLETED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — AuditLog ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | CRM_THREAD_CREATED | ||
| + | |||
| + | CRM_NOTE_REACTION | ||
| + | |||
| + | CRM_TASK_CREATED | ||
| + | |||
| + | CRM_TASK_ASSIGNED | ||
| + | |||
| + | CRM_TASK_COMPLETED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-F.2-J ====== | ||
| + | |||
| + | ===== Préparation Sprint 9 ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Compatible ===== | ||
| + | |||
| + | < | ||
| + | Campaign | ||
| + | |||
| + | MarketingEvent | ||
| + | |||
| + | NotificationCenter | ||
| + | |||
| + | Realtime Communication | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | AiConversation | ||
| + | |||
| + | Recommendation | ||
| + | |||
| + | AutomationScenario | ||
| + | |||
| + | KnowledgeDocument | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Enterprise CRM | ||
| + | |||
| + | Collaboration Analytics | ||
| + | |||
| + | Customer Intelligence | ||
| + | |||
| + | Unified Timeline | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-F.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Threads CRM | ||
| + | |||
| + | ✓ Réponses aux notes | ||
| + | |||
| + | ✓ Réactions | ||
| + | |||
| + | ✓ Assignation | ||
| + | |||
| + | ✓ Tâches CRM | ||
| + | |||
| + | ✓ Notifications temps réel | ||
| + | |||
| + | ✓ Timeline unifiée | ||
| + | |||
| + | ✓ Dashboard collaboration | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | CustomerNoteReaction | ||
| + | |||
| + | CustomerTask | ||
| + | |||
| + | CustomerTaskService | ||
| + | |||
| + | CrmTimelineService | ||
| + | |||
| + | CRM Collaboration API | ||
| + | |||
| + | Unified CRM Timeline | ||
| + | |||
| + | Realtime CRM Events | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1 — Gestion des Communications Client ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Implémenter la couche CRM Communication centralisée permettant de tracer toutes les interactions client. | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Emails | ||
| + | |||
| + | ✓ SMS | ||
| + | |||
| + | ✓ Appels | ||
| + | |||
| + | ✓ Historique communications | ||
| + | |||
| + | ✓ Timeline CRM | ||
| + | |||
| + | ✓ Audit | ||
| + | |||
| + | ✓ Statistiques | ||
| + | |||
| + | ✓ Préparation Marketing | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CustomerCommunication | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | |||
| + | |||
| + | SMS | ||
| + | |||
| + | Calls | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Timeline CRM | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Analytics | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Marketing | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-A ====== | ||
| + | |||
| + | ===== Modèle Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — Création CustomerCommunication ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CustomerCommunication { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | customerId | ||
| + | |||
| + | userId | ||
| + | |||
| + | communicationType | ||
| + | |||
| + | direction | ||
| + | |||
| + | status | ||
| + | |||
| + | subject | ||
| + | |||
| + | content | ||
| + | |||
| + | externalReference | ||
| + | |||
| + | provider | ||
| + | |||
| + | sender | ||
| + | |||
| + | recipient | ||
| + | |||
| + | durationSeconds | ||
| + | |||
| + | scheduledAt | ||
| + | |||
| + | sentAt | ||
| + | |||
| + | deliveredAt | ||
| + | |||
| + | openedAt | ||
| + | |||
| + | repliedAt | ||
| + | |||
| + | metadata | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | deletedAt | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | user User? | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([customerId]) | ||
| + | |||
| + | @@index([communicationType]) | ||
| + | |||
| + | @@index([status]) | ||
| + | |||
| + | @@index([createdAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — CommunicationType ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum CommunicationType { | ||
| + | |||
| + | |||
| + | |||
| + | SMS | ||
| + | |||
| + | PHONE_CALL | ||
| + | |||
| + | |||
| + | |||
| + | PUSH_NOTIFICATION | ||
| + | |||
| + | LETTER | ||
| + | |||
| + | INTERNAL_NOTE | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — Direction ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum CommunicationDirection { | ||
| + | |||
| + | INBOUND | ||
| + | |||
| + | OUTBOUND | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Status ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum CommunicationStatus { | ||
| + | |||
| + | DRAFT | ||
| + | |||
| + | SCHEDULED | ||
| + | |||
| + | SENT | ||
| + | |||
| + | DELIVERED | ||
| + | |||
| + | OPENED | ||
| + | |||
| + | REPLIED | ||
| + | |||
| + | FAILED | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Relation Customer ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | Dans : | ||
| + | |||
| + | <code prisma> | ||
| + | model Customer | ||
| + | </ | ||
| + | |||
| + | <code prisma> | ||
| + | communications CustomerCommunication[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name customer_communications | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-B ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── application | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── domain | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── presentation | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | └── customer-communication.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-C ====== | ||
| + | |||
| + | ===== DTOs ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Create DTO ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | create-customer-communication.dto.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Implémentation ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreateCustomerCommunicationDto { | ||
| + | |||
| + | communicationType: | ||
| + | |||
| + | direction: string; | ||
| + | |||
| + | subject?: string; | ||
| + | |||
| + | content?: string; | ||
| + | |||
| + | recipient?: string; | ||
| + | |||
| + | sender?: string; | ||
| + | |||
| + | scheduledAt?: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Query DTO ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CommunicationQueryDto { | ||
| + | |||
| + | communicationType?: | ||
| + | |||
| + | status?: string; | ||
| + | |||
| + | direction?: string; | ||
| + | |||
| + | page?: number = 1; | ||
| + | |||
| + | limit?: number = 25; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-D ====== | ||
| + | |||
| + | ===== CustomerCommunicationService ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Création ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-communication.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | findAll() | ||
| + | |||
| + | findTimeline() | ||
| + | |||
| + | create() | ||
| + | |||
| + | markDelivered() | ||
| + | |||
| + | markOpened() | ||
| + | |||
| + | markReplied() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Création ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code ts> | ||
| + | await prisma.customerCommunication.create({ | ||
| + | |||
| + | data: { | ||
| + | |||
| + | tenantId, | ||
| + | |||
| + | customerId, | ||
| + | |||
| + | userId, | ||
| + | |||
| + | ...dto | ||
| + | } | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Historisation ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | Dans : | ||
| + | |||
| + | < | ||
| + | CustomerHistory | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Événements ===== | ||
| + | |||
| + | < | ||
| + | COMMUNICATION_CREATED | ||
| + | |||
| + | EMAIL_SENT | ||
| + | |||
| + | SMS_SENT | ||
| + | |||
| + | CALL_LOGGED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-E ====== | ||
| + | |||
| + | ===== Emails ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Intégration ====== | ||
| + | |||
| + | ===== Préparer ===== | ||
| + | |||
| + | < | ||
| + | EmailService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fournisseurs ===== | ||
| + | |||
| + | < | ||
| + | SMTP | ||
| + | |||
| + | SendGrid | ||
| + | |||
| + | Mailgun | ||
| + | |||
| + | AWS SES | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Workflow ====== | ||
| + | |||
| + | < | ||
| + | CRM | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | |||
| + | |||
| + | ↓ | ||
| + | |||
| + | Send | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Tracking | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Timeline | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Tracking ====== | ||
| + | |||
| + | ===== Stocker ===== | ||
| + | |||
| + | < | ||
| + | sentAt | ||
| + | |||
| + | deliveredAt | ||
| + | |||
| + | openedAt | ||
| + | |||
| + | repliedAt | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-F ====== | ||
| + | |||
| + | ===== SMS ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — Intégration ====== | ||
| + | |||
| + | ===== Préparer ===== | ||
| + | |||
| + | < | ||
| + | SmsService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fournisseurs ===== | ||
| + | |||
| + | < | ||
| + | Twilio | ||
| + | |||
| + | OVH SMS | ||
| + | |||
| + | MessageBird | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Tracking ====== | ||
| + | |||
| + | ===== Stocker ===== | ||
| + | |||
| + | < | ||
| + | Sent | ||
| + | |||
| + | Delivered | ||
| + | |||
| + | Failed | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-G ====== | ||
| + | |||
| + | ===== Appels ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Journalisation ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | PHONE_CALL | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Métadonnées ===== | ||
| + | |||
| + | < | ||
| + | Duration | ||
| + | |||
| + | Agent | ||
| + | |||
| + | Outcome | ||
| + | |||
| + | Recording | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-H ====== | ||
| + | |||
| + | ===== Timeline CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | < | ||
| + | Communications | ||
| + | |||
| + | + | ||
| + | |||
| + | Notes | ||
| + | |||
| + | + | ||
| + | |||
| + | Documents | ||
| + | |||
| + | + | ||
| + | |||
| + | Tags | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Vue unifiée ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | [ | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-I ====== | ||
| + | |||
| + | ===== Contrôleur ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Création ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-communication.controller.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Déclaration ===== | ||
| + | |||
| + | <code ts> | ||
| + | @ApiTags( | ||
| + | ' | ||
| + | ) | ||
| + | |||
| + | @Controller( | ||
| + | ' | ||
| + | ) | ||
| + | |||
| + | @UseGuards( | ||
| + | JwtAuthGuard | ||
| + | ) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Endpoints ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Recherche ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | Filtres : | ||
| + | |||
| + | < | ||
| + | Type | ||
| + | |||
| + | Statut | ||
| + | |||
| + | Direction | ||
| + | |||
| + | Période | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.1-J ====== | ||
| + | |||
| + | ===== Audit & Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — AuditLog ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | COMMUNICATION_CREATED | ||
| + | |||
| + | EMAIL_DELIVERED | ||
| + | |||
| + | EMAIL_OPENED | ||
| + | |||
| + | SMS_DELIVERED | ||
| + | |||
| + | CALL_CREATED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — KPI ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Permissions ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | communications.read | ||
| + | |||
| + | communications.write | ||
| + | |||
| + | communications.send | ||
| + | |||
| + | communications.manage | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 9 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Campaign | ||
| + | |||
| + | EmailCampaign | ||
| + | |||
| + | SmsCampaign | ||
| + | |||
| + | NotificationCenter | ||
| + | |||
| + | RealtimeMessaging | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | AiConversation | ||
| + | |||
| + | Recommendation | ||
| + | |||
| + | AutomationScenario | ||
| + | |||
| + | KnowledgeBase | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Customer Intelligence | ||
| + | |||
| + | Communication Analytics | ||
| + | |||
| + | Engagement Scoring | ||
| + | |||
| + | Predictive CRM | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-G.1 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ CustomerCommunication créé | ||
| + | |||
| + | ✓ Emails tracés | ||
| + | |||
| + | ✓ SMS tracés | ||
| + | |||
| + | ✓ Appels tracés | ||
| + | |||
| + | ✓ Historique complet | ||
| + | |||
| + | ✓ Timeline CRM | ||
| + | |||
| + | ✓ AuditLog intégré | ||
| + | |||
| + | ✓ Statistiques CRM | ||
| + | |||
| + | ✓ Swagger documenté | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | CustomerCommunication | ||
| + | |||
| + | CustomerCommunicationModule | ||
| + | |||
| + | CustomerCommunicationController | ||
| + | |||
| + | CustomerCommunicationService | ||
| + | |||
| + | Communication Timeline | ||
| + | |||
| + | Communication Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape suivante ====== | ||
| + | |||
| + | ====== Sprint 3-G.2 — Communication Intelligence & Omnicanal ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Faire évoluer le module CRM Communication vers une plateforme omnicanale Enterprise. | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | ✓ Messagerie instantanée | ||
| + | |||
| + | ✓ Templates | ||
| + | |||
| + | ✓ Campagnes | ||
| + | |||
| + | ✓ Analyse de sentiment | ||
| + | |||
| + | ✓ IA conversationnelle | ||
| + | |||
| + | ✓ Centre omnicanal | ||
| + | |||
| + | ✓ Communication Intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Omnichannel Hub | ||
| + | |||
| + | |||
| + | ├── SMS | ||
| + | |||
| + | ├── Chat | ||
| + | ├── Push | ||
| + | ├── Voice | ||
| + | │ | ||
| + | ↓ | ||
| + | |||
| + | AI Intelligence | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Campaigns | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — CommunicationTemplate ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CommunicationTemplate { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | name String | ||
| + | |||
| + | code String | ||
| + | |||
| + | channel | ||
| + | |||
| + | subject | ||
| + | |||
| + | content | ||
| + | |||
| + | variables | ||
| + | |||
| + | active | ||
| + | @default(true) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | tenantId, | ||
| + | code | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([channel]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — OmnichannelConversation ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model OmnichannelConversation { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | customerId | ||
| + | |||
| + | channel | ||
| + | |||
| + | status | ||
| + | |||
| + | subject | ||
| + | |||
| + | startedAt | ||
| + | @default(now()) | ||
| + | |||
| + | lastMessageAt | ||
| + | |||
| + | closedAt | ||
| + | |||
| + | assignedToId | ||
| + | |||
| + | sentimentScore | ||
| + | |||
| + | aiSummary | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([customerId]) | ||
| + | |||
| + | @@index([channel]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — ConversationMessage ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ConversationMessage { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | conversationId | ||
| + | |||
| + | direction | ||
| + | |||
| + | messageType | ||
| + | |||
| + | content | ||
| + | |||
| + | externalReference | ||
| + | |||
| + | sentAt | ||
| + | @default(now()) | ||
| + | |||
| + | metadata | ||
| + | |||
| + | conversation | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | @@index([conversationId]) | ||
| + | |||
| + | @@index([sentAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum CommunicationChannel { | ||
| + | |||
| + | |||
| + | |||
| + | SMS | ||
| + | |||
| + | |||
| + | |||
| + | CHAT | ||
| + | |||
| + | PUSH | ||
| + | |||
| + | VOICE | ||
| + | } | ||
| + | |||
| + | enum ConversationStatus { | ||
| + | |||
| + | OPEN | ||
| + | |||
| + | ASSIGNED | ||
| + | |||
| + | WAITING_CUSTOMER | ||
| + | |||
| + | CLOSED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name omnichannel_communications | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-B ====== | ||
| + | |||
| + | ===== Omnichannel Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | omnichannel | ||
| + | |||
| + | ├── templates | ||
| + | │ | ||
| + | ├── conversations | ||
| + | │ | ||
| + | |||
| + | │ | ||
| + | ├── chat | ||
| + | │ | ||
| + | ├── ai | ||
| + | │ | ||
| + | └── analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-C ====== | ||
| + | |||
| + | ===== WhatsApp Business ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — WhatsApp Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | whatsapp.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | sendMessage() | ||
| + | |||
| + | sendTemplate() | ||
| + | |||
| + | receiveWebhook() | ||
| + | |||
| + | markDelivered() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Modèles WhatsApp ====== | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Booking Confirmation | ||
| + | |||
| + | Payment Reminder | ||
| + | |||
| + | Welcome Message | ||
| + | |||
| + | Review Request | ||
| + | |||
| + | Check-In Reminder | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Endpoints ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-D ====== | ||
| + | |||
| + | ===== Messagerie Instantanée ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Chat Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | chat.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | startConversation() | ||
| + | |||
| + | sendMessage() | ||
| + | |||
| + | closeConversation() | ||
| + | |||
| + | assignConversation() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Temps réel ====== | ||
| + | |||
| + | ===== Utiliser ===== | ||
| + | |||
| + | < | ||
| + | WebSocket Gateway | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Événements ===== | ||
| + | |||
| + | < | ||
| + | CHAT_MESSAGE | ||
| + | |||
| + | CHAT_TYPING | ||
| + | |||
| + | CHAT_ASSIGNED | ||
| + | |||
| + | CHAT_CLOSED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | PUT / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-E ====== | ||
| + | |||
| + | ===== Templates Enterprise ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Template Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | communication-template.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Variables ===== | ||
| + | |||
| + | < | ||
| + | {{customerName}} | ||
| + | |||
| + | {{reservationNumber}} | ||
| + | |||
| + | {{propertyName}} | ||
| + | |||
| + | {{checkInDate}} | ||
| + | |||
| + | {{amount}} | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Rendu ====== | ||
| + | |||
| + | ===== Méthode ===== | ||
| + | |||
| + | <code ts> | ||
| + | renderTemplate() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | PUT / | ||
| + | |||
| + | DELETE / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-F ====== | ||
| + | |||
| + | ===== Campagnes CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — CampaignCommunication ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CampaignCommunication { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | name String | ||
| + | |||
| + | channel | ||
| + | |||
| + | templateId | ||
| + | |||
| + | targetSegment | ||
| + | |||
| + | status | ||
| + | |||
| + | scheduledAt | ||
| + | |||
| + | sentAt | ||
| + | |||
| + | recipientsCount | ||
| + | @default(0) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Campagnes ====== | ||
| + | |||
| + | ===== Types ===== | ||
| + | |||
| + | < | ||
| + | Newsletter | ||
| + | |||
| + | Promotion | ||
| + | |||
| + | Loyalty | ||
| + | |||
| + | Upsell | ||
| + | |||
| + | Cross-sell | ||
| + | |||
| + | Retention | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET /campaigns | ||
| + | |||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-G ====== | ||
| + | |||
| + | ===== Analyse de Sentiment ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — Extension Conversation ====== | ||
| + | |||
| + | ===== Utiliser ===== | ||
| + | |||
| + | <code prisma> | ||
| + | sentimentScore Float? | ||
| + | |||
| + | aiSummary | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Sentiment ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | < | ||
| + | sentiment-analysis.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Résultat ===== | ||
| + | |||
| + | < | ||
| + | NEGATIVE | ||
| + | |||
| + | NEUTRAL | ||
| + | |||
| + | POSITIVE | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | "Très satisfait" | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | POSITIVE | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | 0.92 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-H ====== | ||
| + | |||
| + | ===== IA Conversationnelle ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — AI Conversation Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | conversation-ai.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Capacités ===== | ||
| + | |||
| + | < | ||
| + | Résumé automatique | ||
| + | |||
| + | Détection intention | ||
| + | |||
| + | Suggestions réponses | ||
| + | |||
| + | Priorisation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Suggestions ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | Client demande remboursement | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Intent: | ||
| + | REFUND_REQUEST | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Réponse suggérée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Résumé ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | < | ||
| + | aiSummary | ||
| + | </ | ||
| + | |||
| + | à la fermeture d'une conversation. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-I ====== | ||
| + | |||
| + | ===== Centre Omnicanal ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Dashboard ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== KPI ===== | ||
| + | |||
| + | < | ||
| + | Conversations ouvertes | ||
| + | |||
| + | Temps réponse moyen | ||
| + | |||
| + | Messages aujourd' | ||
| + | |||
| + | Sentiment moyen | ||
| + | |||
| + | Campagnes actives | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Vue Agent ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Regroupe ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | SMS | ||
| + | |||
| + | |||
| + | |||
| + | Chat | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-G.2-J ====== | ||
| + | |||
| + | ===== Audit & Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — AuditLog ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | WHATSAPP_SENT | ||
| + | |||
| + | CHAT_STARTED | ||
| + | |||
| + | CHAT_ASSIGNED | ||
| + | |||
| + | CAMPAIGN_CREATED | ||
| + | |||
| + | CAMPAIGN_SENT | ||
| + | |||
| + | SENTIMENT_ANALYZED | ||
| + | |||
| + | AI_RESPONSE_GENERATED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Permissions ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | communications.campaigns | ||
| + | |||
| + | communications.templates | ||
| + | |||
| + | communications.omnichannel | ||
| + | |||
| + | communications.ai | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 9 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | NotificationCenter | ||
| + | |||
| + | RealtimeMessaging | ||
| + | |||
| + | CampaignEngine | ||
| + | |||
| + | CommunicationHub | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | AiConversation | ||
| + | |||
| + | AiMessage | ||
| + | |||
| + | Recommendation | ||
| + | |||
| + | AutomationScenario | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Enterprise Analytics | ||
| + | |||
| + | Communication Intelligence | ||
| + | |||
| + | Customer Intelligence | ||
| + | |||
| + | Revenue Intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-G.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ WhatsApp intégré | ||
| + | |||
| + | ✓ Messagerie instantanée | ||
| + | |||
| + | ✓ Templates | ||
| + | |||
| + | ✓ Campagnes CRM | ||
| + | |||
| + | ✓ Analyse de sentiment | ||
| + | |||
| + | ✓ IA conversationnelle | ||
| + | |||
| + | ✓ Centre omnicanal | ||
| + | |||
| + | ✓ Dashboard omnicanal | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | CommunicationTemplate | ||
| + | |||
| + | OmnichannelConversation | ||
| + | |||
| + | ConversationMessage | ||
| + | |||
| + | WhatsAppService | ||
| + | |||
| + | ChatService | ||
| + | |||
| + | ConversationAIService | ||
| + | |||
| + | SentimentAnalysisService | ||
| + | |||
| + | Omnichannel Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1 — Gestion des Préférences Client ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Implémenter la gestion centralisée des préférences client permettant : | ||
| + | |||
| + | < | ||
| + | Personnalisation | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Communication | ||
| + | |||
| + | Fidélisation | ||
| + | |||
| + | Consentements | ||
| + | |||
| + | Expérience client | ||
| + | </ | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Préférences marketing | ||
| + | |||
| + | ✓ Canaux préférés | ||
| + | |||
| + | ✓ Consentements | ||
| + | |||
| + | ✓ Préférences linguistiques | ||
| + | |||
| + | ✓ Préférences monétaires | ||
| + | |||
| + | ✓ Personnalisation CRM | ||
| + | |||
| + | ✓ Conformité RGPD | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CustomerPreference | ||
| + | |||
| + | ├── Marketing | ||
| + | ├── Communication | ||
| + | ├── Language | ||
| + | ├── Currency | ||
| + | ├── Timezone | ||
| + | ├── Loyalty | ||
| + | └── GDPR | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CRM | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Marketing Automation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — Enrichissement CustomerPreference ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CustomerPreference { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | customerId | ||
| + | @unique | ||
| + | |||
| + | preferredLanguage | ||
| + | |||
| + | preferredCurrency | ||
| + | |||
| + | preferredTimezone | ||
| + | |||
| + | preferredChannel | ||
| + | |||
| + | preferredContactTime | ||
| + | |||
| + | prefersEmail | ||
| + | @default(true) | ||
| + | |||
| + | prefersSms | ||
| + | @default(false) | ||
| + | |||
| + | prefersPhone | ||
| + | @default(false) | ||
| + | |||
| + | prefersWhatsApp | ||
| + | @default(false) | ||
| + | |||
| + | acceptsMarketing | ||
| + | @default(false) | ||
| + | |||
| + | acceptsNewsletter | ||
| + | @default(false) | ||
| + | |||
| + | acceptsPromotions | ||
| + | @default(false) | ||
| + | |||
| + | acceptsSurveys | ||
| + | @default(false) | ||
| + | |||
| + | acceptsRecommendations Boolean | ||
| + | | ||
| + | |||
| + | loyaltyEligible | ||
| + | @default(true) | ||
| + | |||
| + | vipProgramEligible | ||
| + | @default(false) | ||
| + | |||
| + | communicationFrequency CommunicationFrequency? | ||
| + | | ||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — PreferredChannel ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum PreferredChannel { | ||
| + | |||
| + | |||
| + | |||
| + | SMS | ||
| + | |||
| + | PHONE | ||
| + | |||
| + | |||
| + | |||
| + | PUSH | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — CommunicationFrequency ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum CommunicationFrequency { | ||
| + | |||
| + | IMMEDIATE | ||
| + | |||
| + | DAILY | ||
| + | |||
| + | WEEKLY | ||
| + | |||
| + | MONTHLY | ||
| + | |||
| + | NEVER | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Consentement RGPD ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | marketingConsentAt | ||
| + | |||
| + | newsletterConsentAt | ||
| + | |||
| + | privacyAcceptedAt | ||
| + | |||
| + | consentVersion | ||
| + | |||
| + | consentIpAddress | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name customer_preferences_enterprise | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-B ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── application | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── domain | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── presentation | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | └── customer-preference.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-C ====== | ||
| + | |||
| + | ===== DTOs ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Update DTO ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | update-customer-preference.dto.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Implémentation ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class UpdateCustomerPreferenceDto { | ||
| + | |||
| + | preferredLanguage?: | ||
| + | |||
| + | preferredCurrency?: | ||
| + | |||
| + | preferredTimezone?: | ||
| + | |||
| + | preferredChannel?: | ||
| + | |||
| + | preferredContactTime?: | ||
| + | |||
| + | prefersEmail?: | ||
| + | |||
| + | prefersSms?: | ||
| + | |||
| + | prefersPhone?: | ||
| + | |||
| + | prefersWhatsApp?: | ||
| + | |||
| + | acceptsMarketing?: | ||
| + | |||
| + | acceptsNewsletter?: | ||
| + | |||
| + | acceptsPromotions?: | ||
| + | |||
| + | acceptsSurveys?: | ||
| + | |||
| + | acceptsRecommendations?: | ||
| + | |||
| + | communicationFrequency?: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Response DTO ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-preference-response.dto.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CustomerPreferenceResponseDto { | ||
| + | |||
| + | preferredLanguage: | ||
| + | |||
| + | preferredCurrency: | ||
| + | |||
| + | preferredChannel: | ||
| + | |||
| + | acceptsMarketing: | ||
| + | |||
| + | acceptsNewsletter: | ||
| + | |||
| + | communicationFrequency: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-D ====== | ||
| + | |||
| + | ===== CustomerPreferenceService ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Création ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-preference.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | findPreferences() | ||
| + | |||
| + | updatePreferences() | ||
| + | |||
| + | validatePreferences() | ||
| + | |||
| + | recordConsent() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Lecture ====== | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | Tenant | ||
| + | </ | ||
| + | |||
| + | avant toute lecture. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code ts> | ||
| + | CustomerPreference | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Mise à jour ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code ts> | ||
| + | await prisma.customerPreference.update({ | ||
| + | |||
| + | where: { | ||
| + | |||
| + | customerId | ||
| + | }, | ||
| + | |||
| + | data: { | ||
| + | |||
| + | ...dto | ||
| + | } | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Consentements ====== | ||
| + | |||
| + | ===== Si ===== | ||
| + | |||
| + | < | ||
| + | acceptsMarketing=true | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code ts> | ||
| + | marketingConsentAt: | ||
| + | new Date() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Si ===== | ||
| + | |||
| + | < | ||
| + | acceptsNewsletter=true | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code ts> | ||
| + | newsletterConsentAt: | ||
| + | new Date() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-E ====== | ||
| + | |||
| + | ===== Validation ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Langues ====== | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | Contre : | ||
| + | |||
| + | < | ||
| + | SupportedLanguages | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Devises ====== | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | Contre : | ||
| + | |||
| + | < | ||
| + | SupportedCurrencies | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Fuseaux horaires ====== | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | Contre : | ||
| + | |||
| + | < | ||
| + | IANA Timezones | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — Cohérence ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | PreferredChannel=SMS | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Téléphone requis | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sinon ===== | ||
| + | |||
| + | <code ts> | ||
| + | throw new BadRequestException() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-F ====== | ||
| + | |||
| + | ===== Personnalisation CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Utilisation ====== | ||
| + | |||
| + | Les préférences alimentent : | ||
| + | |||
| + | < | ||
| + | Marketing | ||
| + | |||
| + | Communication | ||
| + | |||
| + | Campagnes | ||
| + | |||
| + | Recommandations | ||
| + | |||
| + | Automatisation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Exemples ====== | ||
| + | |||
| + | < | ||
| + | Langue = FR | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Templates FR | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | < | ||
| + | Canal = WhatsApp | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Communication WhatsApp | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | < | ||
| + | Fréquence = Weekly | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Digest hebdomadaire | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-G ====== | ||
| + | |||
| + | ===== Contrôleur ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — Création ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-preference.controller.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Déclaration ===== | ||
| + | |||
| + | <code ts> | ||
| + | @ApiTags( | ||
| + | ' | ||
| + | ) | ||
| + | |||
| + | @Controller( | ||
| + | ' | ||
| + | ) | ||
| + | |||
| + | @UseGuards( | ||
| + | JwtAuthGuard | ||
| + | ) | ||
| + | |||
| + | @ApiBearerAuth() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — GET ====== | ||
| + | |||
| + | ===== Route ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — PUT ====== | ||
| + | |||
| + | ===== Route ===== | ||
| + | |||
| + | <code http> | ||
| + | PUT / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-H ====== | ||
| + | |||
| + | ===== Historisation CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — CustomerHistory ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | PREFERENCES_UPDATED | ||
| + | |||
| + | MARKETING_CONSENT_UPDATED | ||
| + | |||
| + | COMMUNICATION_CHANNEL_CHANGED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — AuditLog ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | CUSTOMER_PREFERENCES_UPDATED | ||
| + | |||
| + | CUSTOMER_CONSENT_GRANTED | ||
| + | |||
| + | CUSTOMER_CONSENT_REVOKED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-I ====== | ||
| + | |||
| + | ===== Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Statistiques ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Segmentation ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | acceptsMarketing=true | ||
| + | |||
| + | AND | ||
| + | |||
| + | preferredChannel=EMAIL | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Utilisation ===== | ||
| + | |||
| + | < | ||
| + | Campagnes CRM | ||
| + | |||
| + | Marketing Automation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.1-J ====== | ||
| + | |||
| + | ===== Sécurité & RGPD ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Export ====== | ||
| + | |||
| + | ===== Préparer ===== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | GDPR Export | ||
| + | |||
| + | Data Portability | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Révocation ====== | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | Retrait consentement | ||
| + | |||
| + | Opt-out | ||
| + | |||
| + | Désinscription | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Permissions ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | customer.preferences.read | ||
| + | |||
| + | customer.preferences.write | ||
| + | |||
| + | customer.consent.manage | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 9 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Campaign | ||
| + | |||
| + | MarketingSegment | ||
| + | |||
| + | NotificationCenter | ||
| + | |||
| + | CommunicationHub | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Recommendation | ||
| + | |||
| + | AiConversation | ||
| + | |||
| + | AutomationScenario | ||
| + | |||
| + | Customer Intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 19 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Consent | ||
| + | |||
| + | ComplianceAudit | ||
| + | |||
| + | RetentionPolicy | ||
| + | |||
| + | DataClassification | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-H.1 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ CustomerPreference enrichi | ||
| + | |||
| + | ✓ CustomerPreferenceModule créé | ||
| + | |||
| + | ✓ CustomerPreferenceController créé | ||
| + | |||
| + | ✓ CustomerPreferenceService créé | ||
| + | |||
| + | ✓ Consentements RGPD | ||
| + | |||
| + | ✓ Personnalisation CRM | ||
| + | |||
| + | ✓ Historisation | ||
| + | |||
| + | ✓ AuditLog intégré | ||
| + | |||
| + | ✓ Swagger documenté | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | CustomerPreference Enterprise | ||
| + | |||
| + | CustomerPreferenceModule | ||
| + | |||
| + | CustomerPreferenceController | ||
| + | |||
| + | CustomerPreferenceService | ||
| + | |||
| + | Consent Management | ||
| + | |||
| + | Preference Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2 — Centre de Préférences Enterprise & Consent Management ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Finaliser la couche CRM Enterprise de conformité et de gestion des consentements. | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Consentements RGPD avancés | ||
| + | |||
| + | ✓ Historique complet | ||
| + | |||
| + | ✓ Double Opt-In | ||
| + | |||
| + | ✓ Centre omnicanal | ||
| + | |||
| + | ✓ Gestion abonnements | ||
| + | |||
| + | ✓ Portabilité des données | ||
| + | |||
| + | ✓ Droit à l' | ||
| + | |||
| + | ✓ Audit de conformité | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Consent Center | ||
| + | |||
| + | ├── Marketing | ||
| + | ├── Newsletter | ||
| + | ├── SMS | ||
| + | |||
| + | ├── Push | ||
| + | ├── Profilage | ||
| + | ├── Analytics | ||
| + | └── Partage données | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Compliance | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | GDPR | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-A ====== | ||
| + | |||
| + | ===== Modèle RGPD ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — Création Consent ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Consent { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | customerId | ||
| + | |||
| + | consentType | ||
| + | |||
| + | status | ||
| + | |||
| + | source | ||
| + | |||
| + | version | ||
| + | |||
| + | grantedAt | ||
| + | |||
| + | revokedAt | ||
| + | |||
| + | expiresAt | ||
| + | |||
| + | ipAddress | ||
| + | |||
| + | userAgent | ||
| + | |||
| + | proofReference | ||
| + | |||
| + | metadata | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | history | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([customerId]) | ||
| + | |||
| + | @@index([consentType]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — Historique ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ConsentHistory { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | consentId | ||
| + | |||
| + | oldStatus | ||
| + | |||
| + | newStatus | ||
| + | |||
| + | changedAt | ||
| + | @default(now()) | ||
| + | |||
| + | changedBy | ||
| + | |||
| + | reason | ||
| + | |||
| + | metadata | ||
| + | |||
| + | consent | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | @@index([consentId]) | ||
| + | |||
| + | @@index([changedAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — Types ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ConsentType { | ||
| + | |||
| + | MARKETING | ||
| + | |||
| + | NEWSLETTER | ||
| + | |||
| + | SMS | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | PROFILING | ||
| + | |||
| + | ANALYTICS | ||
| + | |||
| + | THIRD_PARTY_SHARING | ||
| + | |||
| + | PERSONALIZATION | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Status ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ConsentStatus { | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | GRANTED | ||
| + | |||
| + | REVOKED | ||
| + | |||
| + | EXPIRED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Source ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ConsentSource { | ||
| + | |||
| + | WEBSITE | ||
| + | |||
| + | CRM | ||
| + | |||
| + | API | ||
| + | |||
| + | IMPORT | ||
| + | |||
| + | MOBILE_APP | ||
| + | |||
| + | CUSTOMER_PORTAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Relation Customer ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | consents Consent[] | ||
| + | </ | ||
| + | |||
| + | dans : | ||
| + | |||
| + | <code prisma> | ||
| + | model Customer | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name consent_management | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-B ====== | ||
| + | |||
| + | ===== Double Opt-In ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Extension Consent ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | doubleOptInRequired | ||
| + | | ||
| + | |||
| + | doubleOptInToken | ||
| + | |||
| + | doubleOptInSentAt | ||
| + | |||
| + | doubleOptInConfirmedAt DateTime? | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Workflow ====== | ||
| + | |||
| + | < | ||
| + | Inscription | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Consentement | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Email confirmation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Lien sécurisé | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Consentement actif | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | double-optin.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | generateToken() | ||
| + | |||
| + | sendConfirmation() | ||
| + | |||
| + | confirmConsent() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-C ====== | ||
| + | |||
| + | ===== Centre Omnicanal ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Subscription ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CustomerSubscription { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | customerId | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | channel | ||
| + | |||
| + | subscribed | ||
| + | @default(true) | ||
| + | |||
| + | subscribedAt | ||
| + | |||
| + | unsubscribedAt | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | @@index([customerId]) | ||
| + | |||
| + | @@index([channel]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Types ====== | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | Newsletter | ||
| + | |||
| + | Promotions | ||
| + | |||
| + | Loyalty | ||
| + | |||
| + | Product Updates | ||
| + | |||
| + | Reservation Alerts | ||
| + | |||
| + | Security Alerts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | PUT / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-D ====== | ||
| + | |||
| + | ===== Consent Management Service ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Création ====== | ||
| + | |||
| + | < | ||
| + | consent-management.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | grantConsent() | ||
| + | |||
| + | revokeConsent() | ||
| + | |||
| + | expireConsent() | ||
| + | |||
| + | recordProof() | ||
| + | |||
| + | getConsentHistory() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Historisation ====== | ||
| + | |||
| + | ===== Obligatoire ===== | ||
| + | |||
| + | Toute modification crée : | ||
| + | |||
| + | < | ||
| + | ConsentHistory | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — Vérification ====== | ||
| + | |||
| + | ===== Avant envoi ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | SMS | ||
| + | |||
| + | |||
| + | |||
| + | Campagne | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | < | ||
| + | Consent actif | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-E ====== | ||
| + | |||
| + | ===== Portabilité des données ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Export GDPR ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | gdpr-export.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Agréger ===== | ||
| + | |||
| + | < | ||
| + | Customer | ||
| + | |||
| + | Preferences | ||
| + | |||
| + | Consents | ||
| + | |||
| + | Communications | ||
| + | |||
| + | Documents | ||
| + | |||
| + | Notes | ||
| + | |||
| + | Tags | ||
| + | |||
| + | Reservations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Formats ===== | ||
| + | |||
| + | < | ||
| + | JSON | ||
| + | |||
| + | ZIP | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-F ====== | ||
| + | |||
| + | ===== Droit à l' | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — GDPR Erasure ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | gdpr-erasure.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | anonymizeCustomer() | ||
| + | |||
| + | deletePersonalData() | ||
| + | |||
| + | generateErasureReport() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Workflow ====== | ||
| + | |||
| + | < | ||
| + | Demande | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Validation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Anonymisation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Rapport | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Audit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Anonymisation ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | Téléphone | ||
| + | |||
| + | Adresse | ||
| + | |||
| + | Documents | ||
| + | |||
| + | Métadonnées personnelles | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-G ====== | ||
| + | |||
| + | ===== Centre de Préférences ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Endpoint public ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | PUT / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Permet ===== | ||
| + | |||
| + | < | ||
| + | Modifier préférences | ||
| + | |||
| + | Modifier abonnements | ||
| + | |||
| + | Retirer consentements | ||
| + | |||
| + | Télécharger données | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Token sécurisé ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | JWT signé | ||
| + | |||
| + | Expiration configurable | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-H ====== | ||
| + | |||
| + | ===== Compliance Dashboard ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== KPI ===== | ||
| + | |||
| + | < | ||
| + | Total Consents | ||
| + | |||
| + | Active Consents | ||
| + | |||
| + | Revoked Consents | ||
| + | |||
| + | Double Opt-In Pending | ||
| + | |||
| + | Export Requests | ||
| + | |||
| + | Erasure Requests | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-I ====== | ||
| + | |||
| + | ===== Audit & Conformité ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — AuditLog ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | CONSENT_GRANTED | ||
| + | |||
| + | CONSENT_REVOKED | ||
| + | |||
| + | DOUBLE_OPTIN_CONFIRMED | ||
| + | |||
| + | GDPR_EXPORT_REQUESTED | ||
| + | |||
| + | GDPR_ERASURE_REQUESTED | ||
| + | |||
| + | GDPR_ERASURE_COMPLETED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — ComplianceAudit ====== | ||
| + | |||
| + | ===== Préparer ===== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Sprint 19 | ||
| + | |||
| + | ISO27001 | ||
| + | |||
| + | SOC2 | ||
| + | |||
| + | GDPR Audit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — RetentionPolicy ====== | ||
| + | |||
| + | ===== Préparer ===== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | RetentionPolicy | ||
| + | |||
| + | DataClassification | ||
| + | |||
| + | SecurityIncident | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-H.2-J ====== | ||
| + | |||
| + | ===== Permissions ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Ajouter ===== | ||
| + | |||
| + | < | ||
| + | consents.read | ||
| + | |||
| + | consents.write | ||
| + | |||
| + | consents.manage | ||
| + | |||
| + | gdpr.export | ||
| + | |||
| + | gdpr.erase | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 9 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Campaign | ||
| + | |||
| + | NotificationCenter | ||
| + | |||
| + | CommunicationHub | ||
| + | |||
| + | Marketing Automation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 19 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Consent | ||
| + | |||
| + | ComplianceAudit | ||
| + | |||
| + | RetentionPolicy | ||
| + | |||
| + | DataClassification | ||
| + | |||
| + | SecurityPolicy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Enterprise Governance | ||
| + | |||
| + | Enterprise Compliance | ||
| + | |||
| + | Privacy Center | ||
| + | |||
| + | Customer Trust Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-H.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Consent créé | ||
| + | |||
| + | ✓ ConsentHistory créé | ||
| + | |||
| + | ✓ Double Opt-In | ||
| + | |||
| + | ✓ Centre omnicanal | ||
| + | |||
| + | ✓ Gestion abonnements | ||
| + | |||
| + | ✓ Portabilité données | ||
| + | |||
| + | ✓ Droit à l' | ||
| + | |||
| + | ✓ Dashboard conformité | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | Consent | ||
| + | |||
| + | ConsentHistory | ||
| + | |||
| + | CustomerSubscription | ||
| + | |||
| + | ConsentManagementService | ||
| + | |||
| + | DoubleOptInService | ||
| + | |||
| + | GdprExportService | ||
| + | |||
| + | GdprErasureService | ||
| + | |||
| + | Compliance Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1 — Recherche CRM Avancée ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Mettre en place un moteur de recherche CRM Enterprise capable de rechercher instantanément dans l' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Recherche globale | ||
| + | |||
| + | ✓ Recherche plein texte | ||
| + | |||
| + | ✓ Recherche multicritères | ||
| + | |||
| + | ✓ Filtres avancés | ||
| + | |||
| + | ✓ Facettes | ||
| + | |||
| + | ✓ Recherches sauvegardées | ||
| + | |||
| + | ✓ CRM Search Engine | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | CRM Search API | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Search Engine | ||
| + | |||
| + | ├── Customers | ||
| + | ├── Notes | ||
| + | ├── Documents | ||
| + | ├── Communications | ||
| + | ├── Tags | ||
| + | ├── Preferences | ||
| + | └── Reservations | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Filters Engine | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Facets Engine | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Saved Searches | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — SavedSearch ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model SavedSearch { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | userId | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | entityType | ||
| + | |||
| + | query | ||
| + | |||
| + | filters | ||
| + | |||
| + | isDefault | ||
| + | @default(false) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | user User | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — Search History ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model SearchHistory { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | userId | ||
| + | |||
| + | query | ||
| + | |||
| + | entityType | ||
| + | |||
| + | resultCount | ||
| + | @default(0) | ||
| + | |||
| + | executedAt | ||
| + | @default(now()) | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | user User | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | |||
| + | @@index([executedAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — Enum ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum SearchEntityType { | ||
| + | |||
| + | CUSTOMER | ||
| + | |||
| + | NOTE | ||
| + | |||
| + | DOCUMENT | ||
| + | |||
| + | COMMUNICATION | ||
| + | |||
| + | TAG | ||
| + | |||
| + | RESERVATION | ||
| + | |||
| + | GLOBAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name crm_search_engine | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-B ====== | ||
| + | |||
| + | ===== CRM Search Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── application | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── domain | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── presentation | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | └── crm-search.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-C ====== | ||
| + | |||
| + | ===== DTOs ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Recherche ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | crm-search.dto.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CrmSearchDto { | ||
| + | |||
| + | q?: string; | ||
| + | |||
| + | entityType?: | ||
| + | |||
| + | page?: number = 1; | ||
| + | |||
| + | limit?: number = 25; | ||
| + | |||
| + | sortBy?: string; | ||
| + | |||
| + | sortOrder?: ' | ||
| + | |||
| + | filters?: Record< | ||
| + | string, | ||
| + | unknown | ||
| + | >; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Filtres avancés ====== | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | Status | ||
| + | |||
| + | Segment | ||
| + | |||
| + | Tags | ||
| + | |||
| + | Score | ||
| + | |||
| + | Revenue | ||
| + | |||
| + | Risk | ||
| + | |||
| + | Country | ||
| + | |||
| + | Language | ||
| + | |||
| + | Consent | ||
| + | |||
| + | Date | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-D ====== | ||
| + | |||
| + | ===== Recherche Globale ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — CrmSearchService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | crm-search.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | globalSearch() | ||
| + | |||
| + | searchCustomers() | ||
| + | |||
| + | searchNotes() | ||
| + | |||
| + | searchDocuments() | ||
| + | |||
| + | searchCommunications() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Recherche Clients ====== | ||
| + | |||
| + | ===== Champs ===== | ||
| + | |||
| + | < | ||
| + | CustomerNumber | ||
| + | |||
| + | FirstName | ||
| + | |||
| + | LastName | ||
| + | |||
| + | |||
| + | |||
| + | Phone | ||
| + | |||
| + | CompanyName | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prisma ===== | ||
| + | |||
| + | <code ts> | ||
| + | OR: [ | ||
| + | |||
| + | { | ||
| + | firstName: { | ||
| + | contains: q, | ||
| + | mode: ' | ||
| + | } | ||
| + | }, | ||
| + | |||
| + | { | ||
| + | lastName: { | ||
| + | contains: q, | ||
| + | mode: ' | ||
| + | } | ||
| + | }, | ||
| + | |||
| + | { | ||
| + | email: { | ||
| + | contains: q, | ||
| + | mode: ' | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Recherche Globale ====== | ||
| + | |||
| + | ===== Agréger ===== | ||
| + | |||
| + | < | ||
| + | Customers | ||
| + | |||
| + | Notes | ||
| + | |||
| + | Documents | ||
| + | |||
| + | Communications | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-E ====== | ||
| + | |||
| + | ===== Recherche Plein Texte ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — PostgreSQL ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | Colonnes : | ||
| + | |||
| + | < | ||
| + | title | ||
| + | |||
| + | content | ||
| + | |||
| + | subject | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Utiliser ===== | ||
| + | |||
| + | <code sql> | ||
| + | tsvector | ||
| + | |||
| + | tsquery | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Index ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code sql> | ||
| + | CREATE INDEX idx_note_search | ||
| + | ON " | ||
| + | USING GIN( | ||
| + | to_tsvector( | ||
| + | ' | ||
| + | content | ||
| + | ) | ||
| + | ); | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Recherche ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | VIP facture | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | Notes | ||
| + | |||
| + | Documents | ||
| + | |||
| + | Emails concernés. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-F ====== | ||
| + | |||
| + | ===== Recherche Multicritères ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Filtres combinés ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | VIP | ||
| + | |||
| + | + | ||
| + | |||
| + | France | ||
| + | |||
| + | + | ||
| + | |||
| + | Revenue > 5000 | ||
| + | |||
| + | + | ||
| + | |||
| + | Marketing = true | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prisma ===== | ||
| + | |||
| + | <code ts> | ||
| + | AND: [ | ||
| + | ... | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Support ====== | ||
| + | |||
| + | < | ||
| + | Equals | ||
| + | |||
| + | Contains | ||
| + | |||
| + | In | ||
| + | |||
| + | Range | ||
| + | |||
| + | Date | ||
| + | |||
| + | Boolean | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-G ====== | ||
| + | |||
| + | ===== Facettes CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — CrmFacetService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | crm-facet.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | buildFacets() | ||
| + | |||
| + | countSegments() | ||
| + | |||
| + | countTags() | ||
| + | |||
| + | countCountries() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Facettes ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-H ====== | ||
| + | |||
| + | ===== Recherches Sauvegardées ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — SavedSearchService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | saved-search.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | createSearch() | ||
| + | |||
| + | listSearches() | ||
| + | |||
| + | deleteSearch() | ||
| + | |||
| + | executeSavedSearch() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Exemple ====== | ||
| + | |||
| + | ===== Recherche ===== | ||
| + | |||
| + | < | ||
| + | VIP France | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sauvegarder ===== | ||
| + | |||
| + | < | ||
| + | Mes VIP France | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | DELETE / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-I ====== | ||
| + | |||
| + | ===== API Search ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Contrôleur ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | crm-search.controller.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Endpoints ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET /crm-search | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | DELETE / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Exemple ====== | ||
| + | |||
| + | ===== Requête ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.1-J ====== | ||
| + | |||
| + | ===== Audit & Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Historique ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | SearchHistory | ||
| + | </ | ||
| + | |||
| + | automatiquement. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — AuditLog ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | CRM_SEARCH | ||
| + | |||
| + | CRM_GLOBAL_SEARCH | ||
| + | |||
| + | CRM_SAVED_SEARCH | ||
| + | |||
| + | CRM_SEARCH_EXPORT | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — KPI ====== | ||
| + | |||
| + | ===== Endpoint ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Recommendation | ||
| + | |||
| + | KnowledgeDocument | ||
| + | |||
| + | AiConversation | ||
| + | |||
| + | AutomationScenario | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 17 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | RevenueForecast | ||
| + | |||
| + | CustomerAnalytics | ||
| + | |||
| + | Predictive Segmentation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Enterprise Search | ||
| + | |||
| + | Global Search | ||
| + | |||
| + | Data Intelligence | ||
| + | |||
| + | Enterprise Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-I.1 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Recherche globale | ||
| + | |||
| + | ✓ Recherche plein texte | ||
| + | |||
| + | ✓ Recherche multicritères | ||
| + | |||
| + | ✓ Facettes CRM | ||
| + | |||
| + | ✓ Recherches sauvegardées | ||
| + | |||
| + | ✓ Historique recherches | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | |||
| + | ✓ Swagger documenté | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | SavedSearch | ||
| + | |||
| + | SearchHistory | ||
| + | |||
| + | CrmSearchService | ||
| + | |||
| + | CrmFacetService | ||
| + | |||
| + | SavedSearchService | ||
| + | |||
| + | CRM Search API | ||
| + | |||
| + | Enterprise Search Engine | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2 — CRM Search Intelligence & Recommandations ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Faire évoluer le moteur CRM Search vers une plateforme de recherche intelligente assistée par IA. | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Recherche sémantique | ||
| + | |||
| + | ✓ Suggestions intelligentes | ||
| + | |||
| + | ✓ Recherche IA | ||
| + | |||
| + | ✓ Résultats personnalisés | ||
| + | |||
| + | ✓ Recherche prédictive | ||
| + | |||
| + | ✓ Recommandations CRM | ||
| + | |||
| + | ✓ Search Intelligence Engine | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | User Query | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Search Intelligence Layer | ||
| + | |||
| + | ├── Full Text Search | ||
| + | ├── Semantic Search | ||
| + | ├── Predictive Search | ||
| + | ├── Personalized Ranking | ||
| + | └── AI Recommendations | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CRM Knowledge Graph | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Results Engine | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Recommendations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — SearchSuggestion ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model SearchSuggestion { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | query | ||
| + | |||
| + | frequency | ||
| + | @default(1) | ||
| + | |||
| + | lastUsedAt | ||
| + | @default(now()) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | tenantId, | ||
| + | query | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([frequency]) | ||
| + | |||
| + | @@index([lastUsedAt]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — SearchRecommendation ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model SearchRecommendation { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | userId | ||
| + | |||
| + | recommendationType | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | score Float | ||
| + | |||
| + | reason | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | expiresAt | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | user User | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | |||
| + | @@index([score]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — RecommendationType ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum RecommendationType { | ||
| + | |||
| + | RECENT | ||
| + | |||
| + | FREQUENT | ||
| + | |||
| + | RELATED | ||
| + | |||
| + | PREDICTIVE | ||
| + | |||
| + | AI_GENERATED | ||
| + | |||
| + | BEHAVIOR_BASED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name crm_search_ai | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-B ====== | ||
| + | |||
| + | ===== Search Intelligence Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── semantic-search | ||
| + | │ | ||
| + | ├── suggestions | ||
| + | │ | ||
| + | ├── recommendations | ||
| + | │ | ||
| + | ├── predictive-search | ||
| + | │ | ||
| + | ├── ranking | ||
| + | │ | ||
| + | └── ai-search | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-C ====== | ||
| + | |||
| + | ===== Recherche Sémantique ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — SemanticSearchService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | semantic-search.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | semanticSearch() | ||
| + | |||
| + | findRelatedTerms() | ||
| + | |||
| + | expandQuery() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Synonymes CRM ====== | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | VIP | ||
| + | = | ||
| + | Premium | ||
| + | |||
| + | Client | ||
| + | = | ||
| + | Customer | ||
| + | |||
| + | Facture | ||
| + | = | ||
| + | Invoice | ||
| + | |||
| + | Réservation | ||
| + | = | ||
| + | Booking | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Expansion ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | Recherche : | ||
| + | " | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Recherche réelle ===== | ||
| + | |||
| + | < | ||
| + | VIP | ||
| + | |||
| + | Premium | ||
| + | |||
| + | High Value | ||
| + | |||
| + | Loyal Customer | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-D ====== | ||
| + | |||
| + | ===== Suggestions Intelligentes ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — SearchSuggestionService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | search-suggestion.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | generateSuggestions() | ||
| + | |||
| + | recordSearch() | ||
| + | |||
| + | getPopularQueries() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Suggestions ====== | ||
| + | |||
| + | ===== Sources ===== | ||
| + | |||
| + | < | ||
| + | Historique utilisateur | ||
| + | |||
| + | Historique tenant | ||
| + | |||
| + | Popularité | ||
| + | |||
| + | Fréquence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | vip | ||
| + | |||
| + | vip france | ||
| + | |||
| + | vip paris | ||
| + | |||
| + | vip corporate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-E ====== | ||
| + | |||
| + | ===== Résultats Personnalisés ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — PersonalizedRankingService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | personalized-ranking.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | rankResults() | ||
| + | |||
| + | applyUserPreferences() | ||
| + | |||
| + | boostFrequentlyUsedEntities() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Critères ====== | ||
| + | |||
| + | < | ||
| + | Historique utilisateur | ||
| + | |||
| + | Segments favoris | ||
| + | |||
| + | Clients récents | ||
| + | |||
| + | Résultats utilisés | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Exemple ====== | ||
| + | |||
| + | ===== Commercial ===== | ||
| + | |||
| + | < | ||
| + | VIP | ||
| + | |||
| + | Leads | ||
| + | |||
| + | Réservations | ||
| + | </ | ||
| + | |||
| + | plus visibles. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Finance ===== | ||
| + | |||
| + | < | ||
| + | Factures | ||
| + | |||
| + | Paiements | ||
| + | |||
| + | Contrats | ||
| + | </ | ||
| + | |||
| + | plus visibles. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-F ====== | ||
| + | |||
| + | ===== Recherche Prédictive ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — PredictiveSearchService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | predictive-search.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | predictNextQueries() | ||
| + | |||
| + | predictCustomerInterest() | ||
| + | |||
| + | predictRelatedSearches() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — Exemples ====== | ||
| + | |||
| + | ===== Recherche ===== | ||
| + | |||
| + | < | ||
| + | VIP France | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Suggestions ===== | ||
| + | |||
| + | < | ||
| + | VIP Paris | ||
| + | |||
| + | VIP Revenue > 10000 | ||
| + | |||
| + | VIP Loyalty | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Analyse ====== | ||
| + | |||
| + | ===== Basée sur ===== | ||
| + | |||
| + | < | ||
| + | SearchHistory | ||
| + | |||
| + | SavedSearch | ||
| + | |||
| + | CustomerActivity | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-G ====== | ||
| + | |||
| + | ===== Recommandations CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — SearchRecommendationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | search-recommendation.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | generateRecommendations() | ||
| + | |||
| + | recommendCustomers() | ||
| + | |||
| + | recommendSegments() | ||
| + | |||
| + | recommendActions() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — Exemples ====== | ||
| + | |||
| + | ===== Recommandation ===== | ||
| + | |||
| + | < | ||
| + | 23 clients | ||
| + | |||
| + | à risque | ||
| + | |||
| + | non contactés | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Recommandation ===== | ||
| + | |||
| + | < | ||
| + | 12 VIP | ||
| + | |||
| + | sans campagne active | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-H ====== | ||
| + | |||
| + | ===== Recherche IA ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — AI Search Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | ai-search.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | naturalLanguageSearch() | ||
| + | |||
| + | explainResults() | ||
| + | |||
| + | generateInsights() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Exemples ====== | ||
| + | |||
| + | ===== Requête ===== | ||
| + | |||
| + | < | ||
| + | Montre-moi les clients VIP | ||
| + | qui n'ont pas été contactés | ||
| + | depuis 90 jours. | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Traduction ===== | ||
| + | |||
| + | < | ||
| + | Segment=VIP | ||
| + | |||
| + | AND | ||
| + | |||
| + | LastCommunication < 90 jours | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-I ====== | ||
| + | |||
| + | ===== Dashboard Search Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== KPI ===== | ||
| + | |||
| + | < | ||
| + | Top recherches | ||
| + | |||
| + | Suggestions utilisées | ||
| + | |||
| + | Recherche IA | ||
| + | |||
| + | Taux de clic | ||
| + | |||
| + | Recommandations générées | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-I.2-J ====== | ||
| + | |||
| + | ===== Audit & Gouvernance ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — AuditLog ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | SEMANTIC_SEARCH | ||
| + | |||
| + | AI_SEARCH | ||
| + | |||
| + | SEARCH_RECOMMENDATION | ||
| + | |||
| + | SEARCH_SUGGESTION_SELECTED | ||
| + | |||
| + | PREDICTIVE_SEARCH | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Permissions ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | crm.search.ai | ||
| + | |||
| + | crm.search.recommendations | ||
| + | |||
| + | crm.search.analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | AiConversation | ||
| + | |||
| + | KnowledgeGraph | ||
| + | |||
| + | RecommendationEngine | ||
| + | |||
| + | AutomationScenario | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 17 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | RevenueForecast | ||
| + | |||
| + | CustomerAnalytics | ||
| + | |||
| + | PredictiveCRM | ||
| + | |||
| + | BusinessIntelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Enterprise AI | ||
| + | |||
| + | Search Intelligence | ||
| + | |||
| + | Enterprise Knowledge | ||
| + | |||
| + | Decision Support System | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-I.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Recherche sémantique | ||
| + | |||
| + | ✓ Suggestions intelligentes | ||
| + | |||
| + | ✓ Recherche IA | ||
| + | |||
| + | ✓ Résultats personnalisés | ||
| + | |||
| + | ✓ Recherche prédictive | ||
| + | |||
| + | ✓ Recommandations CRM | ||
| + | |||
| + | ✓ Dashboard Search Intelligence | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | SearchSuggestion | ||
| + | |||
| + | SearchRecommendation | ||
| + | |||
| + | SemanticSearchService | ||
| + | |||
| + | PredictiveSearchService | ||
| + | |||
| + | AISearchService | ||
| + | |||
| + | SearchRecommendationService | ||
| + | |||
| + | Search Intelligence Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1 — CRM Analytics & Tableau de Bord ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire le premier cockpit CRM Enterprise centralisant l' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ KPI CRM | ||
| + | |||
| + | ✓ Customer Dashboard | ||
| + | |||
| + | ✓ Segmentation Analytics | ||
| + | |||
| + | ✓ Communication Analytics | ||
| + | |||
| + | ✓ Conversion Analytics | ||
| + | |||
| + | ✓ Revenue Analytics | ||
| + | |||
| + | ✓ Executive Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | CRM Analytics | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Analytics Engine | ||
| + | |||
| + | ├── Customers | ||
| + | ├── Segments | ||
| + | ├── Communications | ||
| + | ├── Revenue | ||
| + | ├── Conversion | ||
| + | └── Loyalty | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Dashboard API | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Frontend Cockpit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — Dashboard Snapshot ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model DashboardSnapshot { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | snapshotDate | ||
| + | |||
| + | metrics | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@unique([ | ||
| + | tenantId, | ||
| + | snapshotDate | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([snapshotDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — KPI Definition ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model KpiDefinition { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String | ||
| + | |||
| + | name String | ||
| + | |||
| + | description | ||
| + | |||
| + | category | ||
| + | |||
| + | active | ||
| + | @default(true) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | @@unique([ | ||
| + | tenantId, | ||
| + | code | ||
| + | ]) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name crm_analytics_dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-B ====== | ||
| + | |||
| + | ===== CRM Analytics Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── application | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── domain | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── presentation | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | └── crm-analytics.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-C ====== | ||
| + | |||
| + | ===== KPI CRM ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — KPI Principaux ====== | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Nombre clients | ||
| + | |||
| + | Clients actifs | ||
| + | |||
| + | Clients inactifs | ||
| + | |||
| + | VIP | ||
| + | |||
| + | Nouveaux clients | ||
| + | |||
| + | Clients à risque | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Customer KPI ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-analytics.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | getCustomerKpis() | ||
| + | |||
| + | getGrowthRate() | ||
| + | |||
| + | getCustomerHealth() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-D ====== | ||
| + | |||
| + | ===== Customer Dashboard ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Widgets ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | Top clients | ||
| + | |||
| + | Derniers clients | ||
| + | |||
| + | Clients à risque | ||
| + | |||
| + | Clients VIP | ||
| + | |||
| + | Croissance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-E ====== | ||
| + | |||
| + | ===== Segmentation Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | segmentation-analytics.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | getSegmentDistribution() | ||
| + | |||
| + | getSegmentGrowth() | ||
| + | |||
| + | getSegmentRevenue() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — KPI ====== | ||
| + | |||
| + | ===== Répartition ===== | ||
| + | |||
| + | < | ||
| + | VIP | ||
| + | |||
| + | Corporate | ||
| + | |||
| + | Loyal | ||
| + | |||
| + | High Value | ||
| + | |||
| + | Standard | ||
| + | |||
| + | At Risk | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-F ====== | ||
| + | |||
| + | ===== Communication Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | communication-analytics.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | getCommunicationStats() | ||
| + | |||
| + | getOpenRate() | ||
| + | |||
| + | getReplyRate() | ||
| + | |||
| + | getChannelPerformance() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — KPI ====== | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Emails envoyés | ||
| + | |||
| + | Emails ouverts | ||
| + | |||
| + | SMS envoyés | ||
| + | |||
| + | SMS délivrés | ||
| + | |||
| + | WhatsApp envoyés | ||
| + | |||
| + | Réponses | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-G ====== | ||
| + | |||
| + | ===== Conversion Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | conversion-analytics.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | getConversionRate() | ||
| + | |||
| + | getLeadConversion() | ||
| + | |||
| + | getCampaignConversion() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — KPI ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | Client créé | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Premier achat | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Client fidèle | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-H ====== | ||
| + | |||
| + | ===== Revenue Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Service ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | revenue-analytics.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | getRevenueMetrics() | ||
| + | |||
| + | getLifetimeValue() | ||
| + | |||
| + | getAverageBasket() | ||
| + | |||
| + | getRevenueBySegment() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — KPI ====== | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Revenue total | ||
| + | |||
| + | MRR CRM | ||
| + | |||
| + | Lifetime Value | ||
| + | |||
| + | Average Basket | ||
| + | |||
| + | Revenue Segment | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-I ====== | ||
| + | |||
| + | ===== Dashboard Exécutif ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== KPI Stratégiques ===== | ||
| + | |||
| + | < | ||
| + | Croissance clients | ||
| + | |||
| + | Croissance revenu | ||
| + | |||
| + | VIP | ||
| + | |||
| + | Attrition | ||
| + | |||
| + | Satisfaction | ||
| + | |||
| + | Engagement | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Snapshot ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | Tous les jours : | ||
| + | |||
| + | < | ||
| + | DashboardSnapshot | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Utilisation ===== | ||
| + | |||
| + | < | ||
| + | Historique | ||
| + | |||
| + | Tendances | ||
| + | |||
| + | Comparaisons | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Comparaison ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.1-J ====== | ||
| + | |||
| + | ===== Audit & Gouvernance ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — AuditLog ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | CRM_DASHBOARD_VIEW | ||
| + | |||
| + | CRM_ANALYTICS_VIEW | ||
| + | |||
| + | CRM_REVENUE_ANALYTICS | ||
| + | |||
| + | CRM_SEGMENT_ANALYTICS | ||
| + | |||
| + | CRM_EXPORT_ANALYTICS | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Permissions ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | crm.analytics.read | ||
| + | |||
| + | crm.analytics.export | ||
| + | |||
| + | crm.analytics.executive | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Export ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Formats ===== | ||
| + | |||
| + | < | ||
| + | CSV | ||
| + | |||
| + | XLSX | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 13 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | RecommendationEngine | ||
| + | |||
| + | AiInsights | ||
| + | |||
| + | Forecasting | ||
| + | |||
| + | Business Intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 17 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Revenue Forecast | ||
| + | |||
| + | Customer Forecast | ||
| + | |||
| + | Predictive Analytics | ||
| + | |||
| + | Financial Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Executive Cockpit | ||
| + | |||
| + | Enterprise BI | ||
| + | |||
| + | Enterprise Analytics | ||
| + | |||
| + | Data Warehouse | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-J.1 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ KPI CRM | ||
| + | |||
| + | ✓ Customer Dashboard | ||
| + | |||
| + | ✓ Segmentation Analytics | ||
| + | |||
| + | ✓ Communication Analytics | ||
| + | |||
| + | ✓ Conversion Analytics | ||
| + | |||
| + | ✓ Revenue Analytics | ||
| + | |||
| + | ✓ Dashboard exécutif | ||
| + | |||
| + | ✓ Export Analytics | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | DashboardSnapshot | ||
| + | |||
| + | KpiDefinition | ||
| + | |||
| + | CrmDashboardService | ||
| + | |||
| + | CustomerAnalyticsService | ||
| + | |||
| + | CommunicationAnalyticsService | ||
| + | |||
| + | ConversionAnalyticsService | ||
| + | |||
| + | RevenueAnalyticsService | ||
| + | |||
| + | Executive Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2 — CRM Intelligence & Analytics Prédictifs ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Finaliser le CRM Enterprise en ajoutant une couche complète d' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Prévision revenus | ||
| + | |||
| + | ✓ Prévision churn | ||
| + | |||
| + | ✓ Prévision LTV | ||
| + | |||
| + | ✓ Détection opportunités | ||
| + | |||
| + | ✓ Détection anomalies | ||
| + | |||
| + | ✓ Insights IA | ||
| + | |||
| + | ✓ Score santé client | ||
| + | |||
| + | ✓ CRM Intelligence Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | CRM Data | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Analytics Engine | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Prediction Engine | ||
| + | |||
| + | ├── Revenue Forecast | ||
| + | ├── Churn Prediction | ||
| + | ├── LTV Prediction | ||
| + | ├── Opportunity Detection | ||
| + | ├── Anomaly Detection | ||
| + | └── Customer Health | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | AI Insights | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Executive Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — CustomerHealth ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CustomerHealth { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | customerId | ||
| + | @unique | ||
| + | |||
| + | overallScore | ||
| + | @default(0) | ||
| + | |||
| + | engagementScore | ||
| + | @default(0) | ||
| + | |||
| + | loyaltyScore | ||
| + | @default(0) | ||
| + | |||
| + | satisfactionScore | ||
| + | @default(0) | ||
| + | |||
| + | communicationScore | ||
| + | @default(0) | ||
| + | |||
| + | revenueScore | ||
| + | @default(0) | ||
| + | |||
| + | churnRiskScore | ||
| + | @default(0) | ||
| + | |||
| + | lastCalculatedAt | ||
| + | @default(now()) | ||
| + | |||
| + | customer | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — PredictionSnapshot ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PredictionSnapshot { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | predictionType | ||
| + | |||
| + | snapshotDate | ||
| + | |||
| + | result | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | tenant | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([predictionType]) | ||
| + | |||
| + | @@index([snapshotDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — AI Insight ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model AiInsight { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | category | ||
| + | |||
| + | severity | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | recommendation | ||
| + | |||
| + | entityType | ||
| + | |||
| + | entityId | ||
| + | |||
| + | active | ||
| + | @default(true) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | expiresAt | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([category]) | ||
| + | |||
| + | @@index([severity]) | ||
| + | |||
| + | @@index([active]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum PredictionType { | ||
| + | |||
| + | REVENUE | ||
| + | |||
| + | CHURN | ||
| + | |||
| + | LTV | ||
| + | |||
| + | OPPORTUNITY | ||
| + | |||
| + | CUSTOMER_HEALTH | ||
| + | } | ||
| + | |||
| + | enum InsightCategory { | ||
| + | |||
| + | REVENUE | ||
| + | |||
| + | CHURN | ||
| + | |||
| + | CUSTOMER | ||
| + | |||
| + | SEGMENT | ||
| + | |||
| + | COMMUNICATION | ||
| + | |||
| + | MARKETING | ||
| + | } | ||
| + | |||
| + | enum InsightSeverity { | ||
| + | |||
| + | LOW | ||
| + | |||
| + | MEDIUM | ||
| + | |||
| + | HIGH | ||
| + | |||
| + | CRITICAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Migration ====== | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name crm_predictive_intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-B ====== | ||
| + | |||
| + | ===== CRM Intelligence Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── revenue-forecast | ||
| + | │ | ||
| + | ├── churn-prediction | ||
| + | │ | ||
| + | ├── ltv-prediction | ||
| + | │ | ||
| + | ├── opportunity-detection | ||
| + | │ | ||
| + | ├── anomaly-detection | ||
| + | │ | ||
| + | ├── ai-insights | ||
| + | │ | ||
| + | ├── customer-health | ||
| + | │ | ||
| + | └── dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-C ====== | ||
| + | |||
| + | ===== Prévision Revenus ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — RevenueForecastService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | revenue-forecast.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | forecastRevenue() | ||
| + | |||
| + | forecastSegmentRevenue() | ||
| + | |||
| + | forecastCustomerRevenue() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Sources ====== | ||
| + | |||
| + | < | ||
| + | Invoices | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Customer LTV | ||
| + | |||
| + | Customer Score | ||
| + | |||
| + | Segments | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-D ====== | ||
| + | |||
| + | ===== Prévision Churn ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — ChurnPredictionService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | churn-prediction.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | calculateChurnRisk() | ||
| + | |||
| + | predictChurn() | ||
| + | |||
| + | detectInactiveCustomers() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Critères ====== | ||
| + | |||
| + | < | ||
| + | Dernière activité | ||
| + | |||
| + | Dernière communication | ||
| + | |||
| + | Baisse dépenses | ||
| + | |||
| + | Baisse engagement | ||
| + | |||
| + | Réclamations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Classification ====== | ||
| + | |||
| + | < | ||
| + | LOW | ||
| + | |||
| + | MEDIUM | ||
| + | |||
| + | HIGH | ||
| + | |||
| + | CRITICAL | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-E ====== | ||
| + | |||
| + | ===== Prévision LTV ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — LtvPredictionService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | ltv-prediction.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | predictLifetimeValue() | ||
| + | |||
| + | predictVipCustomers() | ||
| + | |||
| + | estimateFutureRevenue() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Facteurs ====== | ||
| + | |||
| + | < | ||
| + | Historique achats | ||
| + | |||
| + | Segments | ||
| + | |||
| + | Fidélité | ||
| + | |||
| + | Engagement | ||
| + | |||
| + | Communication | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Retour ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-F ====== | ||
| + | |||
| + | ===== Détection Opportunités ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — OpportunityDetectionService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | opportunity-detection.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | findUpsellOpportunities() | ||
| + | |||
| + | findCrossSellOpportunities() | ||
| + | |||
| + | findRetentionActions() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Exemples ====== | ||
| + | |||
| + | < | ||
| + | VIP | ||
| + | |||
| + | sans offre premium | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Upsell | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | < | ||
| + | Corporate | ||
| + | |||
| + | sans programme fidélité | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Cross-sell | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-G ====== | ||
| + | |||
| + | ===== Détection d' | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — AnomalyDetectionService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | anomaly-detection.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | detectRevenueAnomalies() | ||
| + | |||
| + | detectBehaviorAnomalies() | ||
| + | |||
| + | detectCommunicationAnomalies() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Exemples ====== | ||
| + | |||
| + | < | ||
| + | Baisse revenu | ||
| + | |||
| + | -45% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Anomalie | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | < | ||
| + | Ouvertures emails | ||
| + | |||
| + | 0% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Alerte | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-H ====== | ||
| + | |||
| + | ===== Score Santé Client ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — CustomerHealthService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | customer-health.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | calculateHealthScore() | ||
| + | |||
| + | updateHealthScores() | ||
| + | |||
| + | getHealthDistribution() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Calcul ====== | ||
| + | |||
| + | ===== Pondérations ===== | ||
| + | |||
| + | < | ||
| + | Engagement | ||
| + | |||
| + | Communication | ||
| + | |||
| + | Loyalty | ||
| + | |||
| + | Revenue | ||
| + | |||
| + | Satisfaction | ||
| + | |||
| + | Churn Risk 10% | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Classification ====== | ||
| + | |||
| + | < | ||
| + | 90-100 Excellent | ||
| + | |||
| + | 75-89 Healthy | ||
| + | |||
| + | 50-74 Attention | ||
| + | |||
| + | 0-49 Critical | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-I ====== | ||
| + | |||
| + | ===== AI Insights ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — AiInsightService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | ai-insight.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | generateInsights() | ||
| + | |||
| + | generateRecommendations() | ||
| + | |||
| + | prioritizeActions() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Exemples ====== | ||
| + | |||
| + | ===== Insight ===== | ||
| + | |||
| + | < | ||
| + | 23 VIP | ||
| + | |||
| + | sans contact | ||
| + | |||
| + | depuis 60 jours | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Recommandation ===== | ||
| + | |||
| + | < | ||
| + | Créer campagne VIP | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Insight ===== | ||
| + | |||
| + | < | ||
| + | Segment Corporate | ||
| + | |||
| + | +18% revenu | ||
| + | |||
| + | ce mois-ci | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3-J.2-J ====== | ||
| + | |||
| + | ===== Cockpit CRM Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 30 — Endpoint ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Agrège ===== | ||
| + | |||
| + | < | ||
| + | Forecast Revenue | ||
| + | |||
| + | Churn | ||
| + | |||
| + | LTV | ||
| + | |||
| + | Health | ||
| + | |||
| + | Opportunities | ||
| + | |||
| + | Insights | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 31 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 32 — AuditLog ====== | ||
| + | |||
| + | ===== Journaliser ===== | ||
| + | |||
| + | < | ||
| + | CRM_FORECAST_GENERATED | ||
| + | |||
| + | CRM_CHURN_ANALYSIS | ||
| + | |||
| + | CRM_LTV_PREDICTION | ||
| + | |||
| + | CRM_ANOMALY_DETECTED | ||
| + | |||
| + | CRM_AI_INSIGHT_GENERATED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 33 — Permissions ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | < | ||
| + | crm.intelligence.read | ||
| + | |||
| + | crm.intelligence.forecast | ||
| + | |||
| + | crm.intelligence.insights | ||
| + | |||
| + | crm.intelligence.executive | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 17 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Forecast Engine | ||
| + | |||
| + | Revenue Planning | ||
| + | |||
| + | Financial Intelligence | ||
| + | |||
| + | Business Intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 20 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Enterprise AI | ||
| + | |||
| + | Executive Intelligence | ||
| + | |||
| + | Decision Support | ||
| + | |||
| + | Predictive Analytics | ||
| + | |||
| + | Enterprise BI | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 3-J.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Revenue Forecast | ||
| + | |||
| + | ✓ Churn Prediction | ||
| + | |||
| + | ✓ LTV Prediction | ||
| + | |||
| + | ✓ Opportunity Detection | ||
| + | |||
| + | ✓ Anomaly Detection | ||
| + | |||
| + | ✓ Customer Health Score | ||
| + | |||
| + | ✓ AI Insights | ||
| + | |||
| + | ✓ CRM Intelligence Dashboard | ||
| + | |||
| + | ✓ Audit intégré | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | CustomerHealth | ||
| + | |||
| + | PredictionSnapshot | ||
| + | |||
| + | AiInsight | ||
| + | |||
| + | RevenueForecastService | ||
| + | |||
| + | ChurnPredictionService | ||
| + | |||
| + | LtvPredictionService | ||
| + | |||
| + | OpportunityDetectionService | ||
| + | |||
| + | AnomalyDetectionService | ||
| + | |||
| + | CustomerHealthService | ||
| + | |||
| + | AiInsightService | ||
| + | |||
| + | CRM Intelligence Dashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 3 — Gestion des Clients TERMINÉ ====== | ||
| + | |||
| + | ===== Domaines CRM Livrés ===== | ||
| + | |||
| + | < | ||
| + | ✓ Customer | ||
| + | |||
| + | ✓ CustomerAddress | ||
| + | |||
| + | ✓ CustomerDocument | ||
| + | |||
| + | ✓ CustomerTag | ||
| + | |||
| + | ✓ CustomerNote | ||
| + | |||
| + | ✓ CustomerCommunication | ||
| + | |||
| + | ✓ CustomerPreference | ||
| + | |||
| + | ✓ Consent Management | ||
| + | |||
| + | ✓ CRM Search | ||
| + | |||
| + | ✓ CRM Analytics | ||
| + | |||
| + | ✓ CRM Intelligence | ||
| </ | </ | ||
ujusum/3-codage/2-sprints/3-sprint-3.1781050774.txt.gz · Dernière modification : 2026/06/10 02:19 de 83.202.252.200