Table des matières

Sprint 5 — Réservations

Objectif

Implémenter le cœur transactionnel de la plateforme.

Ce sprint transforme la plateforme Property Management en véritable plateforme de réservation exploitable.

À l'issue du Sprint 5 :

✓ Reservation

✓ Guest

✓ Booking Workflow

✓ Check-In

✓ Check-Out

✓ Payments Integration

✓ Billing

✓ Stay Management

✓ Reservation Intelligence

Architecture cible

Customer

↓

Reservation

↓

Booking Workflow

↓

Payment

↓

Check-In

↓

Stay Management

↓

Check-Out

↓

Billing

↓

Analytics

Domaines métier

Le Sprint 5 introduit les domaines suivants :

Reservation

Guest

ReservationGuest

ReservationPayment

ReservationInvoice

ReservationTimeline

CheckIn

CheckOut

Stay

ReservationDocument

Sous-sprints

Sprint 5-A

Fondation Réservation

Reservation Core

Guest Management

Reservation Lifecycle

Workflow Engine

Sprint 5-B

Paiement & Facturation

Payment Integration

Invoices

Refunds

Transactions

Sprint 5-C

Check-In / Check-Out

Arrival Workflow

Departure Workflow

Digital Check-In

Stay Tracking

Sprint 5-D

Exploitation Séjour

Guest Requests

Incidents

Housekeeping

Maintenance

Sprint 5-E

Reservation Intelligence

Reservation Analytics

Fraud Detection

Booking Insights

Forecasting

Livrables fin Sprint 5

Reservation Engine

Booking Workflow Engine

Payment Platform

Invoice Engine

Check-In Platform

Stay Management

Reservation Analytics

Enterprise Booking System

Sprint 5-A.1 — Implémentation Prisma Reservation Core

Objectif

Créer le cœur du moteur de réservation.

Cette couche constitue la fondation transactionnelle de toute la plateforme.

À l'issue de cette étape :

✓ Reservation

✓ Guest

✓ ReservationGuest

✓ Multi-tenant

✓ Property Ready

✓ Customer Ready

✓ Payment Ready

✓ Analytics Ready

Architecture cible

Customer

↓

Reservation

↓

ReservationGuest

↓

Guests

↓

Payments

↓

Check-In

Sprint 5-A.1-A

Extension Prisma


Étape 1 — Création Reservation

Ajouter dans schema.prisma

model Reservation {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String
 
  customerId            String
 
  reservationNumber     String
                        @unique
 
  status                ReservationStatus
 
  source                ReservationSource
 
  checkInDate           DateTime
 
  checkOutDate          DateTime
 
  nights                Int
 
  adults                Int
                        @default(1)
 
  children              Int
                        @default(0)
 
  infants               Int
                        @default(0)
 
  totalGuests           Int
 
  currency              String
                        @default("EUR")
 
  subtotalAmount        Decimal
                        @db.Decimal(12,2)
 
  taxesAmount           Decimal
                        @db.Decimal(12,2)
 
  feesAmount            Decimal
                        @db.Decimal(12,2)
 
  discountAmount        Decimal
                        @db.Decimal(12,2)
                        @default(0)
 
  totalAmount           Decimal
                        @db.Decimal(12,2)
 
  paidAmount            Decimal
                        @db.Decimal(12,2)
                        @default(0)
 
  notes                 String?
 
  internalNotes         String?
 
  confirmedAt           DateTime?
 
  cancelledAt           DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  tenant                Tenant
                        @relation(
                          fields:[tenantId],
                          references:[id]
                        )
 
  property              Property
                        @relation(
                          fields:[propertyId],
                          references:[id]
                        )
 
  customer              Customer
                        @relation(
                          fields:[customerId],
                          references:[id]
                        )
 
  guests                ReservationGuest[]
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([customerId])
 
  @@index([status])
 
  @@index([checkInDate])
 
  @@index([checkOutDate])
 
  @@index([reservationNumber])
}

Étape 2 — Création Guest

Ajouter

model Guest {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  firstName             String
 
  lastName              String
 
  email                 String?
 
  phone                 String?
 
  dateOfBirth           DateTime?
 
  nationality           String?
 
  documentType          String?
 
  documentNumber        String?
 
  emergencyContact      String?
 
  emergencyPhone        String?
 
  notes                 String?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  tenant                Tenant
                        @relation(
                          fields:[tenantId],
                          references:[id]
                        )
 
  reservations          ReservationGuest[]
 
  @@index([tenantId])
 
  @@index([email])
 
  @@index([lastName])
 
  @@index([documentNumber])
}

Étape 3 — Création ReservationGuest

Ajouter

model ReservationGuest {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationId         String
 
  guestId               String
 
  isPrimaryGuest        Boolean
                        @default(false)
 
  createdAt             DateTime
                        @default(now())
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  guest                 Guest
                        @relation(
                          fields:[guestId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  @@unique([
    reservationId,
    guestId
  ])
 
  @@index([reservationId])
 
  @@index([guestId])
}

Sprint 5-A.1-B

Enums


Étape 4 — ReservationStatus

Ajouter

enum ReservationStatus {
 
  DRAFT
 
  PENDING
 
  CONFIRMED
 
  CHECKED_IN
 
  CHECKED_OUT
 
  COMPLETED
 
  CANCELLED
 
  NO_SHOW
}

Étape 5 — ReservationSource

Ajouter

enum ReservationSource {
 
  DIRECT
 
  WEBSITE
 
  MOBILE_APP
 
  AIRBNB
 
  BOOKING
 
  EXPEDIA
 
  MANUAL
 
  API
}

Sprint 5-A.1-C

Relations Existantes


Étape 6 — Customer

Ajouter

reservations Reservation[]

Étape 7 — Property

Ajouter

reservations Reservation[]

Étape 8 — Tenant

Ajouter

reservations Reservation[]
 
guests Guest[]

Sprint 5-A.1-D

Contraintes Métier


Étape 9 — Validation

Vérifier

checkInDate < checkOutDate

Étape 10 — Vérifier

Calcul automatique

nights

=

checkOutDate
-
checkInDate

Étape 11 — Vérifier

Calcul automatique

totalGuests

=

adults
+
children
+
infants

Étape 12 — Prévenir

Double réservation

via :

PropertyAvailability

Reservation Engine

Sprint 5-A.1-E

Indexation Enterprise


Étape 13 — Ajouter

@@index([
  tenantId,
  status
])
 
@@index([
  propertyId,
  checkInDate
])
 
@@index([
  propertyId,
  checkOutDate
])
 
@@index([
  customerId,
  createdAt
])

Étape 14 — Recherche

Optimiser :

Réservation

Client

Propriété

Date

Statut

Sprint 5-A.1-F

Analytics Ready


Étape 15 — Préparer

Compatible avec :

Occupancy Analytics

Revenue Analytics

Booking Analytics

Forecasting

Étape 16 — Préparer

Compatible avec :

Customer Analytics

Guest Analytics

Travel Patterns

Sprint 5-A.1-G

Migration


Étape 17 — Générer

npx prisma migrate dev \
--name reservation_core

Étape 18 — Générer

npx prisma generate

Étape 19 — Vérifier

npx prisma studio

Présence de :

Reservation

Guest

ReservationGuest

Définition de terminé

Le Sprint 5-A.1 est terminé lorsque :

✓ Reservation créé

✓ Guest créé

✓ ReservationGuest créé

✓ Enums créés

✓ Relations créées

✓ Multi-tenant Ready

✓ Payment Ready

✓ Analytics Ready

✓ Migration exécutée

Livrables

Reservation

Guest

ReservationGuest

ReservationStatus

ReservationSource

Reservation Core Schema

Sprint 5-A.2 — Workflow de Réservation & Lifecycle

Objectif

Transformer le modèle Reservation en véritable moteur transactionnel Enterprise.

Cette couche gère :

Lifecycle

Workflow

Automatisation

Audit

Historique

Orchestration

de toutes les réservations.

À l'issue de cette étape :

✓ ReservationTimeline

✓ ReservationEvent

✓ ReservationWorkflow

✓ Status Machine

✓ Lifecycle Automation

✓ Audit Trail

✓ Booking Orchestration Engine

Architecture cible

Reservation

↓

Workflow Engine

├── State Machine
├── Timeline
├── Events
├── Automation
├── Notifications
└── Audit Trail

↓

Payments

↓

Check-In

↓

Stay Management

Sprint 5-A.2-A

Extension Prisma


Étape 1 — ReservationTimeline

Ajouter dans schema.prisma

model ReservationTimeline {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationId         String
 
  eventType             ReservationEventType
 
  title                 String
 
  description           String?
 
  metadata              Json?
 
  createdBy             String?
 
  createdAt             DateTime
                        @default(now())
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  @@index([reservationId])
 
  @@index([eventType])
 
  @@index([createdAt])
}

Étape 2 — ReservationEvent

Ajouter

model ReservationEvent {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationId         String
 
  eventType             ReservationEventType
 
  oldStatus             ReservationStatus?
 
  newStatus             ReservationStatus?
 
  payload               Json?
 
  processed             Boolean
                        @default(false)
 
  createdAt             DateTime
                        @default(now())
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  @@index([reservationId])
 
  @@index([processed])
 
  @@index([eventType])
}

Étape 3 — ReservationWorkflow

Ajouter

model ReservationWorkflow {
 
  reservationId         String
                        @id
 
  currentStatus         ReservationStatus
 
  lastTransitionAt      DateTime?
 
  workflowVersion       String
                        @default("1.0")
 
  automated             Boolean
                        @default(true)
 
  updatedAt             DateTime
                        @updatedAt
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
}

Étape 4 — Migration

Générer

npx prisma migrate dev \
--name reservation_workflow

Sprint 5-A.2-B

Workflow Engine


Étape 5 — Création Module

src/modules/reservation-workflow

├── workflow
│
├── state-machine
│
├── timeline
│
├── events
│
├── automation
│
└── reservation-workflow.module.ts

Étape 6 — Services

Créer

ReservationWorkflowService

ReservationStateMachineService

ReservationTimelineService

ReservationEventService

ReservationAutomationService

Sprint 5-A.2-C

State Machine


Étape 7 — Définir le Workflow

DRAFT

↓

PENDING

↓

CONFIRMED

↓

CHECKED_IN

↓

CHECKED_OUT

↓

COMPLETED

Étape 8 — États alternatifs

PENDING

↓

CANCELLED

CONFIRMED

↓

NO_SHOW

Étape 9 — Transitions autorisées

const transitions = {
 
  DRAFT: [
    PENDING,
    CANCELLED
  ],
 
  PENDING: [
    CONFIRMED,
    CANCELLED
  ],
 
  CONFIRMED: [
    CHECKED_IN,
    CANCELLED,
    NO_SHOW
  ],
 
  CHECKED_IN: [
    CHECKED_OUT
  ],
 
  CHECKED_OUT: [
    COMPLETED
  ]
};

Étape 10 — Validation

Refuser

toute transition invalide.


Sprint 5-A.2-D

Timeline


Étape 11 — Timeline Service

Créer

reservation-timeline.service.ts

Méthodes

addEvent()
 
getTimeline()
 
buildHistory()

Étape 12 — Historiser

Création

Confirmation

Paiement

Check-In

Check-Out

Annulation

Étape 13 — Exemple

{
  "event":"CONFIRMED",
  "timestamp":"2027-01-10T12:00:00Z"
}

Sprint 5-A.2-E

Event Bus


Étape 14 — ReservationEventService

Créer

reservation-event.service.ts

Émettre

RESERVATION_CREATED

RESERVATION_CONFIRMED

RESERVATION_CANCELLED

CHECKIN_STARTED

CHECKOUT_COMPLETED

Étape 15 — Préparer

Compatible avec :

Payments

Notifications

Invoices

Analytics

Étape 16 — Pattern

Utiliser

Domain Events

pour les futurs microservices.


Sprint 5-A.2-F

Lifecycle Automation


Étape 17 — ReservationAutomationService

Créer

reservation-automation.service.ts

Automatiser

Confirmation

Reminders

Check-In

Check-Out

Completion

Étape 18 — Jobs

Ajouter

J-7 Arrival Reminder

J-1 Arrival Reminder

Check-In Reminder

Check-Out Reminder

Étape 19 — Auto-completion

Passer

CHECKED_OUT

↓

COMPLETED

après validation du séjour.


Sprint 5-A.2-G

Audit Trail


Étape 20 — Audit Intégral

Journaliser

Status Change

User Action

System Action

Automation Action

Étape 21 — Exemple

Reservation #RSV-1001

CONFIRMED

Par :

Admin

Le :

2027-01-05 14:32

Étape 22 — Intégration

Réutiliser

AuditLog

AuditModule

déjà présent dans la plateforme.


Sprint 5-A.2-H

API Workflow


Étape 23 — Endpoints

Ajouter

GET /reservations/{id}/timeline
 
GET /reservations/{id}/workflow
 
POST /reservations/{id}/confirm
 
POST /reservations/{id}/cancel
 
POST /reservations/{id}/check-in
 
POST /reservations/{id}/check-out
 
POST /reservations/{id}/complete

Étape 24 — Exemple

Workflow

{
  "status":"CONFIRMED",
  "lastTransitionAt":"2027-01-05T14:32:00Z"
}

Sprint 5-A.2-I

Sécurité


Étape 25 — Permissions

Ajouter

reservation.read

reservation.create

reservation.update

reservation.cancel

reservation.checkin

reservation.checkout

reservation.workflow

Étape 26 — Multi-Tenant

Vérifier

sur toutes les transitions :

tenantId

propertyId

reservationId

Étape 27 — Idempotence

Garantir

qu'un événement :

CHECK_IN

CHECK_OUT

CONFIRM

ne soit pas exécuté deux fois.


Sprint 5-A.2-J

Préparation Sprint 5-B


Étape 28 — Compatible

Préparer :

Payment Intent

Invoice

Refund

Transaction

Étape 29 — Compatible

Préparer :

Notifications

Emails

SMS

Push

Étape 30 — Compatible

Préparer :

Reservation Analytics

Fraud Detection

Revenue Analytics

Définition de terminé

Le Sprint 5-A.2 est terminé lorsque :

✓ ReservationTimeline créé

✓ ReservationEvent créé

✓ ReservationWorkflow créé

✓ State Machine opérationnelle

✓ Lifecycle Automation opérationnelle

✓ Audit Trail opérationnel

✓ Event Bus opérationnel

Livrables

ReservationTimeline

ReservationEvent

ReservationWorkflow

ReservationWorkflowService

ReservationStateMachineService

ReservationTimelineService

ReservationEventService

ReservationAutomationService

Booking Workflow Engine

Sprint 5-B.1 — Intégration Paiements

Objectif

Connecter le moteur de réservation au moteur financier.

Cette couche gère :

Paiements

Intentions de paiement

Transactions

Remboursements

Webhooks

Réconciliation

pour toutes les réservations.

À l'issue de cette étape :

✓ ReservationPayment

✓ PaymentIntent

✓ Transaction

✓ Refund

✓ Stripe Integration

✓ Webhook Processing

✓ Financial Transaction Engine

Architecture cible

Reservation

↓

Payment Engine

├── Payment Intent
├── Transaction
├── Refund
├── Webhooks
├── Reconciliation
└── Audit

↓

Invoice Engine

↓

Revenue Analytics

Sprint 5-B.1-A

Extension Prisma


Étape 1 — ReservationPayment

Ajouter dans schema.prisma

model ReservationPayment {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String
 
  paymentProvider       PaymentProvider
 
  paymentStatus         PaymentStatus
 
  currency              String
                        @default("EUR")
 
  amount                Decimal
                        @db.Decimal(12,2)
 
  paidAmount            Decimal
                        @db.Decimal(12,2)
                        @default(0)
 
  dueAmount             Decimal
                        @db.Decimal(12,2)
 
  externalReference     String?
 
  paidAt                DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  transactions          PaymentTransaction[]
 
  refunds               PaymentRefund[]
 
  @@index([tenantId])
 
  @@index([reservationId])
 
  @@index([paymentStatus])
}

Étape 2 — PaymentIntent

Ajouter

model PaymentIntent {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationPaymentId  String
 
  providerIntentId      String
                        @unique
 
  amount                Decimal
                        @db.Decimal(12,2)
 
  currency              String
 
  clientSecret          String?
 
  status                PaymentIntentStatus
 
  expiresAt             DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([providerIntentId])
 
  @@index([status])
}

Étape 3 — PaymentTransaction

Ajouter

model PaymentTransaction {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationPaymentId  String
 
  transactionReference  String
                        @unique
 
  providerTransactionId String?
 
  amount                Decimal
                        @db.Decimal(12,2)
 
  currency              String
 
  status                TransactionStatus
 
  metadata              Json?
 
  processedAt           DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([transactionReference])
 
  @@index([status])
}

Étape 4 — PaymentRefund

Ajouter

model PaymentRefund {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationPaymentId  String
 
  transactionId         String?
 
  refundReference       String
                        @unique
 
  amount                Decimal
                        @db.Decimal(12,2)
 
  reason                String?
 
  status                RefundStatus
 
  refundedAt            DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([refundReference])
 
  @@index([status])
}

Étape 5 — Enums

Ajouter

enum PaymentProvider {
 
  STRIPE
 
  PAYPAL
 
  ADYEN
 
  MANUAL
}
 
enum PaymentStatus {
 
  PENDING
 
  PARTIALLY_PAID
 
  PAID
 
  FAILED
 
  REFUNDED
 
  CANCELLED
}
 
enum PaymentIntentStatus {
 
  REQUIRES_PAYMENT_METHOD
 
  REQUIRES_CONFIRMATION
 
  PROCESSING
 
  SUCCEEDED
 
  CANCELED
}
 
enum TransactionStatus {
 
  PENDING
 
  SUCCESS
 
  FAILED
 
  CANCELLED
}
 
enum RefundStatus {
 
  PENDING
 
  PROCESSING
 
  COMPLETED
 
  FAILED
}

Étape 6 — Relations

Ajouter dans Reservation

payments ReservationPayment[]

Étape 7 — Migration

Générer

npx prisma migrate dev \
--name reservation_payments

Sprint 5-B.1-B

Module Paiements


Étape 8 — Création

src/modules/payments

├── stripe
│
├── intents
│
├── transactions
│
├── refunds
│
├── webhooks
│
└── payments.module.ts

Étape 9 — Services

Créer

PaymentService

StripePaymentService

PaymentIntentService

TransactionService

RefundService

WebhookService

Sprint 5-B.1-C

Stripe Integration


Étape 10 — Installation

npm install stripe

Étape 11 — Variables

Ajouter

STRIPE_SECRET_KEY=
 
STRIPE_WEBHOOK_SECRET=
 
STRIPE_PUBLISHABLE_KEY=

Étape 12 — StripePaymentService

Créer

stripe-payment.service.ts

Méthodes

createPaymentIntent()
 
confirmPayment()
 
cancelPayment()
 
retrievePayment()

Étape 13 — Création Intent

Exemple

const intent =
 await stripe.paymentIntents.create({
 
   amount: 12500,
 
   currency: 'eur',
 
   metadata: {
 
     reservationId
   }
 });

Sprint 5-B.1-D

Paiement Réservation


Étape 14 — PaymentService

Créer

payment.service.ts

Méthodes

createReservationPayment()
 
payReservation()
 
capturePayment()
 
cancelPayment()

Étape 15 — Workflow

Reservation

↓

Payment Intent

↓

Stripe

↓

Webhook

↓

PAID

Étape 16 — Mise à jour

Synchroniser

Reservation.paidAmount

ReservationPayment.status

automatiquement.


Sprint 5-B.1-E

Transactions


Étape 17 — TransactionService

Créer

transaction.service.ts

Journaliser

Authorization

Capture

Failure

Cancellation

Étape 18 — Réconciliation

Vérifier

Stripe

=

Base locale

Étape 19 — Référence

Générer

TX-2027-000001

pour chaque transaction.


Sprint 5-B.1-F

Remboursements


Étape 20 — RefundService

Créer

refund.service.ts

Méthodes

createRefund()
 
approveRefund()
 
executeRefund()

Étape 21 — Supporter

Full Refund

Partial Refund

Policy Refund

Étape 22 — Exemple

Paiement

500 €

↓

Refund

100 €

Sprint 5-B.1-G

Webhooks


Étape 23 — WebhookController

Créer

webhook.controller.ts

Étape 24 — Endpoint

Ajouter

POST /payments/webhooks/stripe

Étape 25 — Traiter

payment_intent.succeeded

payment_intent.payment_failed

charge.refunded

charge.dispute.created

Étape 26 — Sécuriser

Vérifier

STRIPE_WEBHOOK_SECRET

avant traitement.


Sprint 5-B.1-H

API Paiements


Étape 27 — Endpoints

Ajouter

POST /reservations/{id}/payments
 
GET  /reservations/{id}/payments
 
POST /payments/intents
 
POST /payments/{id}/capture
 
POST /payments/{id}/refund
 
GET  /payments/{id}/transactions

Étape 28 — Exemple

Retour

{
  "paymentIntentId":"pi_xxx",
  "clientSecret":"secret_xxx"
}

Sprint 5-B.1-I

Sécurité


Étape 29 — Permissions

Ajouter

payment.read

payment.create

payment.capture

payment.refund

payment.webhook

payment.admin

Étape 30 — Audit

Journaliser

PAYMENT_CREATED

PAYMENT_SUCCEEDED

PAYMENT_FAILED

REFUND_CREATED

REFUND_COMPLETED

WEBHOOK_RECEIVED

Étape 31 — Idempotence

Garantir

pour :

Webhooks

Captures

Refunds

afin d'éviter les doublons.


Sprint 5-B.1-J

Préparation Sprint 5-B.2


Étape 32 — Compatible

Préparer :

Invoices

Credit Notes

Taxes

Accounting

Étape 33 — Compatible

Préparer :

Multi Currency

Payment Plans

Installments

Deposit Payments

Définition de terminé

Le Sprint 5-B.1 est terminé lorsque :

✓ ReservationPayment créé

✓ PaymentIntent créé

✓ PaymentTransaction créé

✓ PaymentRefund créé

✓ Stripe intégré

✓ Webhooks intégrés

✓ Refunds intégrés

✓ Audit intégré

Livrables

ReservationPayment

PaymentIntent

PaymentTransaction

PaymentRefund

StripePaymentService

PaymentService

RefundService

WebhookService

Enterprise Payment Platform

Sprint 5-B.2 — Facturation Enterprise & Comptabilité

Objectif

Transformer le moteur de paiement en plateforme financière Enterprise.

Cette couche gère :

Facturation

Avoirs

Fiscalité

Comptabilité

Conformité financière

Exports ERP

À l'issue de cette étape :

✓ Invoice

✓ InvoiceLine

✓ CreditNote

✓ Tax Engine

✓ Accounting Export

✓ Financial Compliance

✓ Financial Platform

Architecture cible

Reservation

↓

Payment

↓

Invoice Engine

├── Invoices
├── Invoice Lines
├── Credit Notes
├── Tax Engine
├── Accounting
└── Compliance

↓

ERP

↓

Financial Reporting

Sprint 5-B.2-A

Extension Prisma


Étape 1 — Invoice

Ajouter dans schema.prisma

model Invoice {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String?
 
  customerId            String
 
  invoiceNumber         String
                        @unique
 
  status                InvoiceStatus
 
  currency              String
                        @default("EUR")
 
  issueDate             DateTime
 
  dueDate               DateTime?
 
  subtotalAmount        Decimal
                        @db.Decimal(14,2)
 
  taxAmount             Decimal
                        @db.Decimal(14,2)
 
  totalAmount           Decimal
                        @db.Decimal(14,2)
 
  paidAmount            Decimal
                        @db.Decimal(14,2)
                        @default(0)
 
  notes                 String?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  lines                 InvoiceLine[]
 
  creditNotes           CreditNote[]
 
  @@index([tenantId])
 
  @@index([reservationId])
 
  @@index([customerId])
 
  @@index([status])
}

Étape 2 — InvoiceLine

Ajouter

model InvoiceLine {
 
  id                    String
                        @id
                        @default(uuid())
 
  invoiceId             String
 
  description           String
 
  quantity              Decimal
                        @db.Decimal(10,2)
 
  unitPrice             Decimal
                        @db.Decimal(12,2)
 
  taxRate               Decimal
                        @db.Decimal(5,2)
 
  totalAmount           Decimal
                        @db.Decimal(14,2)
 
  createdAt             DateTime
                        @default(now())
 
  invoice               Invoice
                        @relation(
                          fields:[invoiceId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  @@index([invoiceId])
}

Étape 3 — CreditNote

Ajouter

model CreditNote {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  invoiceId             String
 
  creditNoteNumber      String
                        @unique
 
  reason                String
 
  amount                Decimal
                        @db.Decimal(14,2)
 
  status                CreditNoteStatus
 
  issuedAt              DateTime
 
  createdAt             DateTime
                        @default(now())
 
  invoice               Invoice
                        @relation(
                          fields:[invoiceId],
                          references:[id]
                        )
 
  @@index([tenantId])
 
  @@index([invoiceId])
 
  @@index([status])
}

Étape 4 — AccountingExport

Ajouter

model AccountingExport {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  exportType            AccountingExportType
 
  fileName              String
 
  status                ExportStatus
 
  generatedAt           DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([exportType])
 
  @@index([status])
}

Étape 5 — Enums

Ajouter

enum InvoiceStatus {
 
  DRAFT
 
  ISSUED
 
  PARTIALLY_PAID
 
  PAID
 
  OVERDUE
 
  CANCELLED
}
 
enum CreditNoteStatus {
 
  DRAFT
 
  ISSUED
 
  APPLIED
 
  CANCELLED
}
 
enum AccountingExportType {
 
  CSV
 
  FEC
 
  SAGE
 
  CEGID
 
  QUICKBOOKS
 
  XERO
}
 
enum ExportStatus {
 
  PENDING
 
  PROCESSING
 
  COMPLETED
 
  FAILED
}

Étape 6 — Migration

Générer

npx prisma migrate dev \
--name invoicing_accounting

Sprint 5-B.2-B

Invoice Module


Étape 7 — Création

src/modules/invoicing

├── invoices
│
├── credit-notes
│
├── taxes
│
├── exports
│
├── compliance
│
└── invoicing.module.ts

Étape 8 — Services

Créer

InvoiceService

InvoiceLineService

CreditNoteService

TaxEngineService

AccountingExportService

FinancialComplianceService

Sprint 5-B.2-C

Génération de Factures


Étape 9 — InvoiceService

Créer

invoice.service.ts

Méthodes

createInvoice()
 
issueInvoice()
 
markAsPaid()
 
cancelInvoice()
 
generatePdf()

Étape 10 — Numérotation

Générer

INV-2027-000001

de manière séquentielle.


Étape 11 — Facturation Réservation

Générer automatiquement

après :

Reservation Confirmed

ou

Payment Completed

selon configuration.


Sprint 5-B.2-D

Tax Engine


Étape 12 — TaxEngineService

Créer

tax-engine.service.ts

Supporter

TVA France

TVA UE

Taxe de séjour

Taxes locales

Exonérations

Étape 13 — TaxRule

Ajouter

model TaxRule {
 
  id                    String
                        @id
                        @default(uuid())
 
  countryCode           String
 
  regionCode            String?
 
  taxType               String
 
  rate                  Decimal
                        @db.Decimal(6,3)
 
  active                Boolean
                        @default(true)
 
  createdAt             DateTime
                        @default(now())
 
  @@index([countryCode])
 
  @@index([taxType])
}

Étape 14 — Calcul

Supporter

HT

TVA

TTC

pour toutes les factures.


Sprint 5-B.2-E

Avoirs


Étape 15 — CreditNoteService

Créer

credit-note.service.ts

Méthodes

createCreditNote()
 
applyCreditNote()
 
cancelCreditNote()

Étape 16 — Cas d'usage

Annulation

Remboursement

Erreur facturation

Geste commercial

Étape 17 — Exemple

Facture

500 €

↓

Avoir

100 €

Sprint 5-B.2-F

Exports Comptables


Étape 18 — AccountingExportService

Créer

accounting-export.service.ts

Formats

CSV

Excel

FEC

Sage

Cegid

QuickBooks

Xero

Étape 19 — Endpoints

Ajouter

POST /accounting/exports
 
GET  /accounting/exports
 
GET  /accounting/exports/{id}

Étape 20 — Jobs

Générer

exports mensuels automatiques.


Sprint 5-B.2-G

Conformité Financière


Étape 21 — FinancialComplianceService

Créer

financial-compliance.service.ts

Contrôler

Numérotation

Intégrité

TVA

Archivage

Traçabilité

Étape 22 — Audit

Garantir

l'immutabilité des factures émises.


Étape 23 — Archivage

Supporter

PDF/A

Stockage S3

Conservation légale

Sprint 5-B.2-H

API Facturation


Étape 24 — Endpoints

Ajouter

GET    /invoices
 
GET    /invoices/{id}
 
POST   /invoices
 
POST   /invoices/{id}/issue
 
POST   /invoices/{id}/pay
 
POST   /credit-notes
 
GET    /credit-notes

Étape 25 — Exemple

Réponse

{
  "invoiceNumber":"INV-2027-000001",
  "status":"ISSUED",
  "totalAmount":1250.00
}

Sprint 5-B.2-I

Sécurité


Étape 26 — Permissions

Ajouter

invoice.read

invoice.create

invoice.issue

invoice.pay

invoice.export

creditnote.manage

accounting.admin

Étape 27 — Multi-Tenant

Vérifier

sur :

Invoice

CreditNote

AccountingExport

Étape 28 — Audit

Journaliser

INVOICE_CREATED

INVOICE_ISSUED

INVOICE_PAID

CREDIT_NOTE_CREATED

ACCOUNTING_EXPORT_GENERATED

Sprint 5-B.2-J

Préparation Sprint 5-C


Étape 29 — Compatible

Préparer :

Check-In

Check-Out

Guest Identity

Arrival Workflow

Étape 30 — Compatible

Préparer :

Revenue Recognition

Financial Reporting

BI Platform

Enterprise ERP

Définition de terminé

Le Sprint 5-B.2 est terminé lorsque :

✓ Invoice créé

✓ InvoiceLine créé

✓ CreditNote créé

✓ Tax Engine créé

✓ Exports comptables créés

✓ Conformité financière créée

✓ Audit intégré

Livrables

Invoice

InvoiceLine

CreditNote

TaxRule

AccountingExport

InvoiceService

CreditNoteService

TaxEngineService

AccountingExportService

FinancialComplianceService

Enterprise Financial Platform

Sprint 5-C.1 — Check-In Digital & Gestion des Arrivées

Objectif

Implémenter l'expérience d'arrivée complète des voyageurs.

Cette couche transforme la réservation confirmée en séjour actif.

À l'issue de cette étape :

✓ CheckIn

✓ Guest Verification

✓ Identity Documents

✓ Arrival Workflow

✓ Digital Signature

✓ Arrival Dashboard

✓ Digital Arrival Platform

Architecture cible

Reservation

↓

Arrival Workflow

├── Guest Verification
├── Identity Documents
├── Digital Signature
├── Check-In Validation
├── Key Delivery
└── Arrival Dashboard

↓

Stay Management

↓

Check-Out

Sprint 5-C.1-A

Extension Prisma


Étape 1 — CheckIn

Ajouter dans schema.prisma

model CheckIn {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String
                        @unique
 
  status                CheckInStatus
 
  scheduledAt           DateTime?
 
  startedAt             DateTime?
 
  completedAt           DateTime?
 
  verified              Boolean
                        @default(false)
 
  signatureCompleted    Boolean
                        @default(false)
 
  notes                 String?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  documents             IdentityDocument[]
 
  @@index([tenantId])
 
  @@index([status])
}

Étape 2 — IdentityDocument

Ajouter

model IdentityDocument {
 
  id                    String
                        @id
                        @default(uuid())
 
  checkInId             String
 
  guestId               String
 
  documentType          IdentityDocumentType
 
  documentNumber        String?
 
  storagePath           String
 
  verificationStatus    VerificationStatus
 
  verifiedAt            DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  checkIn               CheckIn
                        @relation(
                          fields:[checkInId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  @@index([checkInId])
 
  @@index([guestId])
 
  @@index([verificationStatus])
}

Étape 3 — GuestVerification

Ajouter

model GuestVerification {
 
  id                    String
                        @id
                        @default(uuid())
 
  guestId               String
 
  verificationStatus    VerificationStatus
 
  verificationMethod    VerificationMethod
 
  riskScore             Float?
                        @default(0)
 
  verifiedAt            DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([guestId])
 
  @@index([verificationStatus])
}

Étape 4 — DigitalSignature

Ajouter

model DigitalSignature {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationId         String
 
  signerId              String
 
  documentType          String
 
  signaturePath         String?
 
  signedAt              DateTime?
 
  ipAddress             String?
 
  status                SignatureStatus
 
  createdAt             DateTime
                        @default(now())
 
  @@index([reservationId])
 
  @@index([signerId])
 
  @@index([status])
}

Étape 5 — Enums

Ajouter

enum CheckInStatus {
 
  PENDING
 
  IN_PROGRESS
 
  VERIFIED
 
  COMPLETED
 
  REJECTED
}
 
enum IdentityDocumentType {
 
  PASSPORT
 
  ID_CARD
 
  DRIVER_LICENSE
 
  RESIDENCE_PERMIT
}
 
enum VerificationStatus {
 
  PENDING
 
  VERIFIED
 
  REJECTED
 
  MANUAL_REVIEW
}
 
enum VerificationMethod {
 
  MANUAL
 
  OCR
 
  BIOMETRIC
 
  THIRD_PARTY
}

Étape 6 — Migration

Générer

npx prisma migrate dev \
--name digital_checkin

Sprint 5-C.1-B

Check-In Module


Étape 7 — Création

src/modules/checkin

├── checkin
│
├── verification
│
├── documents
│
├── signatures
│
├── arrivals
│
└── checkin.module.ts

Étape 8 — Services

Créer

CheckInService

GuestVerificationService

IdentityDocumentService

DigitalSignatureService

ArrivalWorkflowService

ArrivalDashboardService

Sprint 5-C.1-C

Workflow d'Arrivée


Étape 9 — ArrivalWorkflowService

Créer

arrival-workflow.service.ts

Workflow

Reservation Confirmed

↓

Document Upload

↓

Identity Verification

↓

Digital Signature

↓

Check-In Approval

↓

Arrival Completed

Étape 10 — Validation

Exiger

Document valide

Signature valide

Paiement conforme

avant check-in.


Étape 11 — Automatisation

Déclencher

J-7 Arrival Email

J-3 Reminder

J-1 Check-In Link

Arrival Instructions

Sprint 5-C.1-D

Vérification Voyageur


Étape 12 — GuestVerificationService

Créer

guest-verification.service.ts

Méthodes

verifyGuest()
 
calculateRiskScore()
 
approveVerification()
 
rejectVerification()

Étape 13 — Contrôles

Vérifier

Identité

Âge

Document expiré

Doublons

Blacklist

Étape 14 — Risk Score

Calculer

à partir de :

Documents

Historique

Pays

Fraude

Sprint 5-C.1-E

Gestion Documentaire


Étape 15 — IdentityDocumentService

Créer

identity-document.service.ts

Méthodes

uploadDocument()
 
validateDocument()
 
extractDocumentData()
 
deleteDocument()

Étape 16 — Upload

Supporter

Passport

Carte identité

Permis

Titre séjour

Étape 17 — Stockage

Utiliser

MinIO

S3

Encryption At Rest

Étape 18 — OCR

Extraire

Nom

Prénom

Date naissance

Numéro document

Expiration

Sprint 5-C.1-F

Signature Numérique


Étape 19 — DigitalSignatureService

Créer

digital-signature.service.ts

Méthodes

requestSignature()
 
signDocument()
 
verifySignature()

Étape 20 — Documents

Supporter

Contrat location

Conditions générales

Règlement intérieur

Décharge responsabilité

Étape 21 — Journaliser

Date

IP

Utilisateur

Document

Sprint 5-C.1-G

Arrival Dashboard


Étape 22 — ArrivalDashboardService

Créer

arrival-dashboard.service.ts

Afficher

Arrivées du jour

Check-In en attente

Vérifications manuelles

Documents manquants

Signatures manquantes

Étape 23 — KPI

Mesurer

Arrival Completion Rate

Average Check-In Time

Verification Success Rate

Digital Adoption Rate

Étape 24 — Endpoint

Ajouter

GET /arrivals/dashboard

Sprint 5-C.1-H

API Check-In


Étape 25 — Endpoints

Ajouter

GET  /reservations/{id}/checkin
 
POST /reservations/{id}/checkin/start
 
POST /reservations/{id}/documents
 
POST /reservations/{id}/verify
 
POST /reservations/{id}/signature
 
POST /reservations/{id}/checkin/complete

Étape 26 — Réponse

Exemple

{
  "status":"VERIFIED",
  "documentsValid":true,
  "signatureCompleted":true
}

Sprint 5-C.1-I

Sécurité


Étape 27 — Permissions

Ajouter

checkin.read

checkin.start

checkin.verify

checkin.complete

checkin.documents

checkin.admin

Étape 28 — RGPD

Appliquer

Consentement

Chiffrement

Conservation limitée

Suppression automatique

aux documents d'identité.


Étape 29 — Audit

Journaliser

CHECKIN_STARTED

DOCUMENT_UPLOADED

GUEST_VERIFIED

SIGNATURE_COMPLETED

CHECKIN_COMPLETED

Sprint 5-C.1-J

Préparation Sprint 5-C.2


Étape 30 — Compatible

Préparer :

Check-Out

Damage Reports

Deposit Release

Guest Satisfaction

Étape 31 — Compatible

Préparer :

Smart Locks

Keyless Entry

IoT Access

Mobile Keys

Définition de terminé

Le Sprint 5-C.1 est terminé lorsque :

✓ CheckIn créé

✓ Guest Verification créée

✓ Identity Documents créés

✓ Arrival Workflow créé

✓ Digital Signature créée

✓ Arrival Dashboard créé

✓ Audit intégré

Livrables

CheckIn

IdentityDocument

GuestVerification

DigitalSignature

CheckInService

GuestVerificationService

IdentityDocumentService

DigitalSignatureService

ArrivalWorkflowService

ArrivalDashboardService

Digital Check-In Platform

Sprint 5-C.2 — Check-Out Digital & Clôture du Séjour

Objectif

Finaliser le cycle de vie complet du séjour.

Cette couche transforme un séjour actif en séjour clôturé tout en gérant :

Départ

Contrôle logement

Dépôt de garantie

Satisfaction client

Clôture financière

Clôture opérationnelle

À l'issue de cette étape :

✓ CheckOut

✓ Damage Report

✓ Deposit Release

✓ Guest Feedback

✓ Stay Closure

✓ Departure Dashboard

✓ Digital Departure Platform

Architecture cible

Stay

↓

Check-Out Workflow

├── Departure Validation
├── Damage Inspection
├── Deposit Release
├── Guest Feedback
├── Invoice Closure
└── Reservation Completion

↓

Analytics

↓

CRM

↓

Reviews

Sprint 5-C.2-A

Extension Prisma


Étape 1 — CheckOut

Ajouter dans schema.prisma

model CheckOut {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String
                        @unique
 
  status                CheckOutStatus
 
  scheduledAt           DateTime?
 
  startedAt             DateTime?
 
  completedAt           DateTime?
 
  depositReleased       Boolean
                        @default(false)
 
  feedbackSubmitted     Boolean
                        @default(false)
 
  notes                 String?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  damageReports         DamageReport[]
 
  @@index([tenantId])
 
  @@index([status])
}

Étape 2 — DamageReport

Ajouter

model DamageReport {
 
  id                    String
                        @id
                        @default(uuid())
 
  checkOutId            String
 
  severity              DamageSeverity
 
  category              DamageCategory
 
  title                 String
 
  description           String?
 
  estimatedCost         Decimal?
                        @db.Decimal(12,2)
 
  resolved              Boolean
                        @default(false)
 
  createdAt             DateTime
                        @default(now())
 
  checkOut              CheckOut
                        @relation(
                          fields:[checkOutId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  photos                DamagePhoto[]
 
  @@index([checkOutId])
 
  @@index([severity])
 
  @@index([resolved])
}

Étape 3 — DamagePhoto

Ajouter

model DamagePhoto {
 
  id                    String
                        @id
                        @default(uuid())
 
  damageReportId        String
 
  imageUrl              String
 
  createdAt             DateTime
                        @default(now())
 
  damageReport          DamageReport
                        @relation(
                          fields:[damageReportId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  @@index([damageReportId])
}

Étape 4 — GuestFeedback

Ajouter

model GuestFeedback {
 
  id                    String
                        @id
                        @default(uuid())
 
  reservationId         String
                        @unique
 
  overallRating         Int
 
  cleanlinessRating     Int?
 
  comfortRating         Int?
 
  serviceRating         Int?
 
  comment               String?
 
  submittedAt           DateTime
                        @default(now())
 
  reservation           Reservation
                        @relation(
                          fields:[reservationId],
                          references:[id],
                          onDelete:Cascade
                        )
}

Étape 5 — Enums

Ajouter

enum CheckOutStatus {
 
  PENDING
 
  IN_PROGRESS
 
  INSPECTED
 
  COMPLETED
}
 
enum DamageSeverity {
 
  LOW
 
  MEDIUM
 
  HIGH
 
  CRITICAL
}
 
enum DamageCategory {
 
  CLEANING
 
  FURNITURE
 
  ELECTRICAL
 
  PLUMBING
 
  SECURITY
 
  OTHER
}

Étape 6 — Migration

Générer

npx prisma migrate dev \
--name digital_checkout

Sprint 5-C.2-B

Check-Out Module


Étape 7 — Création

src/modules/checkout

├── checkout
│
├── damages
│
├── deposits
│
├── feedback
│
├── departure
│
└── checkout.module.ts

Étape 8 — Services

Créer

CheckOutService

DamageReportService

DepositReleaseService

GuestFeedbackService

StayClosureService

DepartureDashboardService

Sprint 5-C.2-C

Workflow de Départ


Étape 9 — StayClosureService

Créer

stay-closure.service.ts

Workflow

Check-Out Started

↓

Inspection

↓

Damage Review

↓

Deposit Decision

↓

Feedback

↓

Reservation Completed

Étape 10 — Validation

Vérifier

Paiements finalisés

Inspection terminée

Aucune anomalie bloquante

avant clôture.


Étape 11 — Automatisation

Déclencher

Check-Out Reminder

Feedback Request

Review Invitation

CRM Update

Sprint 5-C.2-D

Gestion des Dégradations


Étape 12 — DamageReportService

Créer

damage-report.service.ts

Méthodes

createDamageReport()
 
uploadDamagePhoto()
 
estimateDamageCost()
 
resolveDamage()

Étape 13 — Catégories

Supporter

Ménage

Mobilier

Électrique

Plomberie

Sécurité

Étape 14 — IA Future

Préparer :

Vision AI

Damage Detection

Cost Estimation

Sprint 5-C.2-E

Libération du Dépôt


Étape 15 — DepositReleaseService

Créer

deposit-release.service.ts

Méthodes

releaseDeposit()
 
holdDeposit()
 
partialRelease()
 
chargeDamageCost()

Étape 16 — Scénarios

Supporter

Full Release

Partial Release

Full Retention

Étape 17 — Intégration

Connecter

SecurityDepositPolicy

PaymentRefund

ReservationPayment

Sprint 5-C.2-F

Feedback Voyageur


Étape 18 — GuestFeedbackService

Créer

guest-feedback.service.ts

Méthodes

submitFeedback()
 
calculateSatisfaction()
 
generateReviewRequest()

Étape 19 — Notes

Collecter

Propreté

Confort

Service

Expérience globale

Étape 20 — Intégration

Alimenter

Property Reviews

CRM Analytics

Property Reputation

Sprint 5-C.2-G

Departure Dashboard


Étape 21 — DepartureDashboardService

Créer

departure-dashboard.service.ts

Afficher

Départs du jour

Inspections en attente

Dépôts à rembourser

Feedbacks reçus

Incidents ouverts

Étape 22 — KPI

Mesurer

Checkout Completion Rate

Average Checkout Time

Deposit Release Time

Guest Satisfaction

Étape 23 — Endpoint

Ajouter

GET /departures/dashboard

Sprint 5-C.2-H

API Check-Out


Étape 24 — Endpoints

Ajouter

GET  /reservations/{id}/checkout
 
POST /reservations/{id}/checkout/start
 
POST /reservations/{id}/damage-reports
 
POST /reservations/{id}/deposit/release
 
POST /reservations/{id}/feedback
 
POST /reservations/{id}/checkout/complete

Étape 25 — Réponse

Exemple

{
  "status":"COMPLETED",
  "depositReleased":true,
  "feedbackSubmitted":true
}

Sprint 5-C.2-I

Sécurité


Étape 26 — Permissions

Ajouter

checkout.read

checkout.start

checkout.complete

checkout.damage

checkout.deposit

checkout.admin

Étape 27 — Audit

Journaliser

CHECKOUT_STARTED

DAMAGE_REPORTED

DEPOSIT_RELEASED

FEEDBACK_SUBMITTED

CHECKOUT_COMPLETED

Étape 28 — Multi-Tenant

Vérifier

sur :

CheckOut

DamageReport

GuestFeedback

Sprint 5-C.2-J

Préparation Sprint 5-D


Étape 29 — Compatible

Préparer :

Housekeeping

Maintenance

Guest Requests

Incident Management

Étape 30 — Compatible

Préparer :

Guest Journey

Customer Success

Operational Excellence

Service Automation

Définition de terminé

Le Sprint 5-C.2 est terminé lorsque :

✓ CheckOut créé

✓ DamageReport créé

✓ Deposit Release créé

✓ Guest Feedback créé

✓ Stay Closure créé

✓ Departure Dashboard créé

✓ Audit intégré

Livrables

CheckOut

DamageReport

DamagePhoto

GuestFeedback

CheckOutService

DamageReportService

DepositReleaseService

GuestFeedbackService

StayClosureService

DepartureDashboardService

Digital Check-Out Platform

Sprint 5-D.1 — Gestion des Demandes Voyageurs & Service Desk

Objectif

Mettre en place la couche opérationnelle du séjour.

Cette couche permet de gérer :

Demandes voyageurs

Incidents

Maintenance

Tâches

Communication

Suivi opérationnel

depuis l'arrivée jusqu'au départ.

À l'issue de cette étape :

✓ GuestRequest

✓ ServiceTicket

✓ Incident

✓ TaskAssignment

✓ Guest Communication

✓ Service Dashboard

✓ Hospitality Service Desk

Architecture cible

Guest

↓

Guest Request

↓

Service Desk

├── Tickets
├── Incidents
├── Tasks
├── Communications
├── Escalations
└── SLA

↓

Operations

↓

Analytics

Sprint 5-D.1-A

Extension Prisma


Étape 1 — GuestRequest

Ajouter dans schema.prisma

model GuestRequest {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String
 
  guestId               String?
 
  requestType           GuestRequestType
 
  priority              TicketPriority
 
  status                TicketStatus
 
  subject               String
 
  description           String
 
  requestedAt           DateTime
                        @default(now())
 
  resolvedAt            DateTime?
 
  satisfactionScore     Int?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  tickets               ServiceTicket[]
 
  @@index([tenantId])
 
  @@index([reservationId])
 
  @@index([status])
 
  @@index([priority])
}

Étape 2 — ServiceTicket

Ajouter

model ServiceTicket {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  guestRequestId        String
 
  assignedTo            String?
 
  ticketNumber          String
                        @unique
 
  status                TicketStatus
 
  priority              TicketPriority
 
  slaDueAt              DateTime?
 
  resolvedAt            DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  request               GuestRequest
                        @relation(
                          fields:[guestRequestId],
                          references:[id],
                          onDelete:Cascade
                        )
 
  tasks                 TaskAssignment[]
 
  @@index([tenantId])
 
  @@index([assignedTo])
 
  @@index([status])
}

Étape 3 — Incident

Ajouter

model Incident {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String?
 
  propertyId            String
 
  severity              IncidentSeverity
 
  category              IncidentCategory
 
  title                 String
 
  description           String
 
  status                IncidentStatus
 
  openedAt              DateTime
                        @default(now())
 
  closedAt              DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([status])
 
  @@index([severity])
}

Étape 4 — TaskAssignment

Ajouter

model TaskAssignment {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  ticketId              String?
 
  incidentId            String?
 
  assignedUserId        String
 
  title                 String
 
  description           String?
 
  dueDate               DateTime?
 
  completed             Boolean
                        @default(false)
 
  completedAt           DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([assignedUserId])
 
  @@index([completed])
}

Étape 5 — GuestCommunication

Ajouter

model GuestCommunication {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  reservationId         String
 
  channel               CommunicationChannel
 
  direction             CommunicationDirection
 
  subject               String?
 
  message               String
 
  sentAt                DateTime
                        @default(now())
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([reservationId])
 
  @@index([channel])
}

Étape 6 — Enums

Ajouter

enum GuestRequestType {
 
  HOUSEKEEPING
 
  MAINTENANCE
 
  AMENITY
 
  INFORMATION
 
  CHECKIN
 
  CHECKOUT
 
  TRANSPORT
 
  OTHER
}
 
enum TicketStatus {
 
  OPEN
 
  IN_PROGRESS
 
  WAITING
 
  RESOLVED
 
  CLOSED
}
 
enum TicketPriority {
 
  LOW
 
  MEDIUM
 
  HIGH
 
  URGENT
}
 
enum IncidentSeverity {
 
  LOW
 
  MEDIUM
 
  HIGH
 
  CRITICAL
}
 
enum IncidentStatus {
 
  OPEN
 
  INVESTIGATING
 
  RESOLVED
 
  CLOSED
}
 
enum IncidentCategory {
 
  FACILITY
 
  SECURITY
 
  CLEANING
 
  PAYMENT
 
  TECHNICAL
 
  OTHER
}
 
enum CommunicationChannel {
 
  EMAIL
 
  SMS
 
  PHONE
 
  WHATSAPP
 
  IN_APP
}
 
enum CommunicationDirection {
 
  INBOUND
 
  OUTBOUND
}

Étape 7 — Migration

Générer

npx prisma migrate dev \
--name guest_service_desk

Sprint 5-D.1-B

Module Service Desk


Étape 8 — Création

src/modules/service-desk

├── guest-requests
│
├── tickets
│
├── incidents
│
├── tasks
│
├── communications
│
├── sla
│
└── service-desk.module.ts

Étape 9 — Services

Créer

GuestRequestService

ServiceTicketService

IncidentService

TaskAssignmentService

GuestCommunicationService

ServiceDashboardService

Sprint 5-D.1-C

Demandes Voyageurs


Étape 10 — GuestRequestService

Créer

guest-request.service.ts

Méthodes

createRequest()
 
assignRequest()
 
resolveRequest()
 
rateSatisfaction()

Étape 11 — Cas d'usage

Supporter

Serviettes

Ménage

Réparation

Questions

Transport

Assistance

Étape 12 — Workflow

Guest Request

↓

Ticket

↓

Assignment

↓

Resolution

↓

Feedback

Sprint 5-D.1-D

Tickets & SLA


Étape 13 — ServiceTicketService

Créer

service-ticket.service.ts

SLA par priorité

LOW      48h

MEDIUM   24h

HIGH      8h

URGENT    1h

Étape 14 — Méthodes

createTicket()
 
assignTicket()
 
escalateTicket()
 
closeTicket()

Étape 15 — Numérotation

Générer

TKT-2027-000001

Sprint 5-D.1-E

Gestion des Incidents


Étape 16 — IncidentService

Créer

incident.service.ts

Méthodes

openIncident()
 
investigateIncident()
 
resolveIncident()
 
closeIncident()

Étape 17 — Types

Supporter

Panne climatisation

Fuite

Problème serrure

Sécurité

Incident paiement

Étape 18 — Escalade

Automatique

si :

Severity = CRITICAL

Sprint 5-D.1-F

Assignation des Tâches


Étape 19 — TaskAssignmentService

Créer

task-assignment.service.ts

Méthodes

assignTask()
 
completeTask()
 
reassignTask()

Étape 20 — Assignation

Supporter

Housekeeping

Maintenance

Reception

Manager

Étape 21 — Notifications

Déclencher

lors des nouvelles tâches.


Sprint 5-D.1-G

Communications Voyageur


Étape 22 — GuestCommunicationService

Créer

guest-communication.service.ts

Méthodes

sendMessage()
 
receiveMessage()
 
getConversation()

Étape 23 — Canaux

Supporter

Email

SMS

Téléphone

WhatsApp

In-App

Étape 24 — Timeline

Centraliser

toutes les interactions client.


Sprint 5-D.1-H

Service Dashboard


Étape 25 — ServiceDashboardService

Créer

service-dashboard.service.ts

Afficher

Tickets ouverts

Tickets SLA en retard

Incidents actifs

Tâches assignées

Satisfaction client

Étape 26 — KPI

Mesurer

Resolution Time

SLA Compliance

Ticket Volume

CSAT

Incident Rate

Étape 27 — Endpoint

Ajouter

GET /service-desk/dashboard

Sprint 5-D.1-I

API Service Desk


Étape 28 — Endpoints

Ajouter

GET    /guest-requests
 
POST   /guest-requests
 
PUT    /guest-requests/{id}
 
POST   /tickets/{id}/assign
 
POST   /tickets/{id}/close
 
POST   /incidents
 
PUT    /incidents/{id}
 
POST   /tasks/{id}/complete
 
GET    /communications/{reservationId}

Étape 29 — Exemple

Création demande

{
  "requestType":"HOUSEKEEPING",
  "subject":"Serviettes supplémentaires"
}

Sprint 5-D.1-J

Gouvernance


Étape 30 — Permissions

Ajouter

service.read

service.manage

service.assign

service.incident

service.communication

service.admin

Étape 31 — Audit

Journaliser

REQUEST_CREATED

TICKET_ASSIGNED

INCIDENT_OPENED

TASK_COMPLETED

MESSAGE_SENT

SLA_BREACHED

Étape 32 — Préparation Sprint 5-D.2

Compatible avec :

Housekeeping Automation

Maintenance Management

Operational Intelligence

Work Orders

Définition de terminé

Le Sprint 5-D.1 est terminé lorsque :

✓ GuestRequest créé

✓ ServiceTicket créé

✓ Incident créé

✓ TaskAssignment créé

✓ GuestCommunication créé

✓ Service Dashboard créé

✓ SLA intégré

✓ Audit intégré

Livrables

GuestRequest

ServiceTicket

Incident

TaskAssignment

GuestCommunication

GuestRequestService

ServiceTicketService

IncidentService

TaskAssignmentService

GuestCommunicationService

ServiceDashboardService

Hospitality Service Desk

Sprint 5-D.2 — Housekeeping & Maintenance Operations

Objectif

Automatiser les opérations terrain de la plateforme.

Cette couche permet de piloter :

Ménage

Maintenance

Statut des logements

Inventaire

Maintenance préventive

Performance opérationnelle

afin de transformer la plateforme en véritable PMS (Property Management System).

À l'issue de cette étape :

✓ Housekeeping

✓ Room Status

✓ Maintenance Work Orders

✓ Preventive Maintenance

✓ Inventory Usage

✓ Operations Dashboard

✓ Operations Management Platform

Architecture cible

Reservation

↓

Operations Engine

├── Housekeeping
├── Room Status
├── Maintenance
├── Preventive Maintenance
├── Inventory
└── Operations Dashboard

↓

Property Operations

↓

Analytics

Sprint 5-D.2-A

Extension Prisma


Étape 1 — HousekeepingTask

Ajouter dans schema.prisma

model HousekeepingTask {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String
 
  reservationId         String?
 
  assignedUserId        String?
 
  taskType              HousekeepingTaskType
 
  status                HousekeepingStatus
 
  priority              TaskPriority
 
  scheduledAt           DateTime?
 
  startedAt             DateTime?
 
  completedAt           DateTime?
 
  notes                 String?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([status])
 
  @@index([assignedUserId])
}

Étape 2 — PropertyRoomStatus

Ajouter

model PropertyRoomStatus {
 
  propertyId            String
                        @id
 
  status                RoomStatus
 
  lastUpdatedAt         DateTime
                        @updatedAt
 
  notes                 String?
 
  property              Property
                        @relation(
                          fields:[propertyId],
                          references:[id],
                          onDelete:Cascade
                        )
}

Étape 3 — MaintenanceWorkOrder

Ajouter

model MaintenanceWorkOrder {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String
 
  assignedUserId        String?
 
  category              MaintenanceCategory
 
  priority              TaskPriority
 
  status                WorkOrderStatus
 
  title                 String
 
  description           String?
 
  estimatedCost         Decimal?
                        @db.Decimal(12,2)
 
  actualCost            Decimal?
                        @db.Decimal(12,2)
 
  scheduledAt           DateTime?
 
  completedAt           DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([status])
 
  @@index([priority])
}

Étape 4 — PreventiveMaintenance

Ajouter

model PreventiveMaintenance {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String
 
  title                 String
 
  frequencyDays         Int
 
  nextDueDate           DateTime
 
  active                Boolean
                        @default(true)
 
  lastCompletedAt       DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([nextDueDate])
}

Étape 5 — InventoryUsage

Ajouter

model InventoryUsage {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String
 
  itemName              String
 
  quantity              Decimal
                        @db.Decimal(10,2)
 
  unit                  String
 
  usedAt                DateTime
                        @default(now())
 
  referenceType         String?
 
  referenceId           String?
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([usedAt])
}

Étape 6 — Enums

Ajouter

enum HousekeepingTaskType {
 
  CHECKOUT_CLEANING
 
  DEEP_CLEANING
 
  INSPECTION
 
  LINEN_CHANGE
 
  RESTOCK
 
  OTHER
}
 
enum HousekeepingStatus {
 
  PENDING
 
  ASSIGNED
 
  IN_PROGRESS
 
  COMPLETED
 
  CANCELLED
}
 
enum RoomStatus {
 
  AVAILABLE
 
  OCCUPIED
 
  DIRTY
 
  CLEANING
 
  INSPECTING
 
  OUT_OF_SERVICE
}
 
enum MaintenanceCategory {
 
  HVAC
 
  ELECTRICAL
 
  PLUMBING
 
  FURNITURE
 
  SECURITY
 
  APPLIANCE
 
  GENERAL
}
 
enum WorkOrderStatus {
 
  OPEN
 
  ASSIGNED
 
  IN_PROGRESS
 
  COMPLETED
 
  CANCELLED
}
 
enum TaskPriority {
 
  LOW
 
  MEDIUM
 
  HIGH
 
  URGENT
}

Étape 7 — Migration

Générer

npx prisma migrate dev \
--name operations_management

Sprint 5-D.2-B

Operations Module


Étape 8 — Création

src/modules/operations

├── housekeeping
│
├── room-status
│
├── maintenance
│
├── preventive-maintenance
│
├── inventory
│
├── dashboard
│
└── operations.module.ts

Étape 9 — Services

Créer

HousekeepingService

RoomStatusService

MaintenanceWorkOrderService

PreventiveMaintenanceService

InventoryUsageService

OperationsDashboardService

Sprint 5-D.2-C

Housekeeping


Étape 10 — HousekeepingService

Créer

housekeeping.service.ts

Méthodes

createCleaningTask()
 
assignTask()
 
startCleaning()
 
completeCleaning()

Étape 11 — Automatisation

Générer automatiquement

Check-Out

↓

Cleaning Task

Étape 12 — Workflow

DIRTY

↓

CLEANING

↓

INSPECTING

↓

AVAILABLE

Sprint 5-D.2-D

Room Status


Étape 13 — RoomStatusService

Créer

room-status.service.ts

Méthodes

updateStatus()
 
getStatus()
 
transitionStatus()

Étape 14 — Synchronisation

Alimenter

à partir de :

Reservation

CheckIn

CheckOut

Housekeeping

Étape 15 — Temps Réel

Afficher

Occupé

Disponible

En ménage

Hors service

Sprint 5-D.2-E

Maintenance


Étape 16 — MaintenanceWorkOrderService

Créer

maintenance-work-order.service.ts

Méthodes

createWorkOrder()
 
assignTechnician()
 
completeWorkOrder()
 
calculateCosts()

Étape 17 — Origines

Supporter

Incident

Inspection

Preventive Maintenance

Manual Request

Étape 18 — Escalade

Automatique

si :

Priority = URGENT

Sprint 5-D.2-F

Maintenance Préventive


Étape 19 — PreventiveMaintenanceService

Créer

preventive-maintenance.service.ts

Méthodes

scheduleMaintenance()
 
generateWorkOrders()
 
markCompleted()

Étape 20 — Exemples

Climatisation

90 jours

↓

Work Order auto

Détecteur fumée

180 jours

↓

Inspection auto

Sprint 5-D.2-G

Inventaire


Étape 21 — InventoryUsageService

Créer

inventory-usage.service.ts

Suivre

Produits ménage

Linge

Consommables

Produits accueil

Étape 22 — Méthodes

registerUsage()
 
calculateConsumption()
 
forecastInventory()

Étape 23 — Alertes

Déclencher

sur :

Stock faible

Surconsommation

Rupture

Sprint 5-D.2-H

Operations Dashboard


Étape 24 — OperationsDashboardService

Créer

operations-dashboard.service.ts

Afficher

Nettoyages en attente

Logements sales

Work Orders ouverts

Maintenances prévues

Consommation inventaire

Étape 25 — KPI

Mesurer

Cleaning Time

Room Turnover Time

Maintenance SLA

Inventory Cost

Operational Efficiency

Étape 26 — Endpoint

Ajouter

GET /operations/dashboard

Sprint 5-D.2-I

API Operations


Étape 27 — Endpoints

Ajouter

GET    /housekeeping/tasks
 
POST   /housekeeping/tasks
 
PUT    /housekeeping/tasks/{id}
 
GET    /room-status
 
PUT    /room-status/{propertyId}
 
GET    /maintenance/work-orders
 
POST   /maintenance/work-orders
 
PUT    /maintenance/work-orders/{id}
 
GET    /preventive-maintenance
 
POST   /preventive-maintenance
 
GET    /inventory/usage

Étape 28 — Exemple

Work Order

{
  "category":"HVAC",
  "priority":"HIGH",
  "title":"Réparation climatisation"
}

Sprint 5-D.2-J

Gouvernance


Étape 29 — Permissions

Ajouter

operations.read

operations.housekeeping

operations.maintenance

operations.inventory

operations.dashboard

operations.admin

Étape 30 — Audit

Journaliser

HOUSEKEEPING_CREATED

HOUSEKEEPING_COMPLETED

ROOM_STATUS_UPDATED

WORK_ORDER_CREATED

WORK_ORDER_COMPLETED

PREVENTIVE_MAINTENANCE_EXECUTED

Étape 31 — Jobs

Ajouter

Toutes les heures

Maintenance Scheduler

Toutes les nuits

Inventory Forecast

Operations KPIs Refresh

Clôture Domaine Opérations

À la fin du Sprint 5-D.2 :

✓ Service Desk

✓ Guest Requests

✓ Incidents

✓ Housekeeping

✓ Maintenance

✓ Inventory

✓ Operations Dashboard

sont entièrement opérationnels.


Sprint 5-E.1 — Reservation Analytics & Revenue KPIs

Objectif

Mettre en place le cockpit analytique des réservations.

Cette couche fournit une vision complète de :

Réservations

Revenus

Annulations

Voyageurs

Performance

Conversion

afin de piloter l'activité commerciale et opérationnelle.

À l'issue de cette étape :

✓ Reservation Dashboard

✓ Booking Analytics

✓ Revenue KPIs

✓ Cancellation Analytics

✓ Guest Analytics

✓ Reservation Performance

✓ Reservation Intelligence Dashboard

Architecture cible

Reservations

↓

Reservation Analytics

├── Booking Analytics
├── Revenue Analytics
├── Cancellation Analytics
├── Guest Analytics
├── Conversion Analytics
└── KPI Dashboard

↓

Revenue Management

↓

Executive Reporting

Sprint 5-E.1-A

Extension Prisma


Étape 1 — ReservationAnalyticsSnapshot

Ajouter dans schema.prisma

model ReservationAnalyticsSnapshot {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  snapshotDate          DateTime
 
  reservationsCount     Int
                        @default(0)
 
  confirmedBookings     Int
                        @default(0)
 
  cancelledBookings     Int
                        @default(0)
 
  revenue               Decimal
                        @db.Decimal(14,2)
 
  averageBookingValue   Decimal
                        @db.Decimal(14,2)
 
  averageLengthOfStay   Float?
 
  occupancyImpact       Float?
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([snapshotDate])
}

Étape 2 — ReservationKPI

Ajouter

model ReservationKPI {
 
  tenantId              String
                        @id
 
  bookingConversionRate Float?
 
  cancellationRate      Float?
 
  averageBookingValue   Float?
 
  averageStayLength     Float?
 
  repeatGuestRate       Float?
 
  revenuePerBooking     Float?
 
  updatedAt             DateTime
                        @updatedAt
}

Étape 3 — Migration

Générer

npx prisma migrate dev \
--name reservation_analytics

Sprint 5-E.1-B

Reservation Analytics Module


Étape 4 — Création

src/modules/reservation-analytics

├── dashboard
│
├── bookings
│
├── revenue
│
├── cancellations
│
├── guests
│
├── performance
│
└── reservation-analytics.module.ts

Étape 5 — Services

Créer

ReservationDashboardService

BookingAnalyticsService

RevenueKPIService

CancellationAnalyticsService

GuestAnalyticsService

ReservationPerformanceService

Sprint 5-E.1-C

Booking Analytics


Étape 6 — BookingAnalyticsService

Créer

booking-analytics.service.ts

Méthodes

calculateBookings()
 
calculateBookingTrend()
 
analyzeBookingSources()
 
analyzeLeadTime()

Étape 7 — Mesurer

Total Reservations

Confirmed Reservations

Pending Reservations

No Shows

Lead Time

Étape 8 — Sources

Analyser

Direct

Website

Mobile App

Airbnb

Booking

Expedia

Sprint 5-E.1-D

Revenue KPIs


Étape 9 — RevenueKPIService

Créer

revenue-kpi.service.ts

Calculer

Gross Revenue

Net Revenue

Average Booking Value

Revenue Per Booking

Revenue Growth

Étape 10 — Exemple

Revenue

125 000 €

↑ 14%

Étape 11 — Intégration

Utiliser

Reservation

Payments

Invoices

Refunds

Sprint 5-E.1-E

Cancellation Analytics


Étape 12 — CancellationAnalyticsService

Créer

cancellation-analytics.service.ts

Méthodes

calculateCancellationRate()
 
analyzeCancellationReasons()
 
forecastCancellationRisk()

Étape 13 — Mesurer

Cancellation Rate

Refund Rate

No Show Rate

Cancellation Cost

Étape 14 — Segmentation

Analyser

par :

Property

Source

Country

Season

Sprint 5-E.1-F

Guest Analytics


Étape 15 — GuestAnalyticsService

Créer

guest-analytics.service.ts

Mesurer

Repeat Guests

New Guests

Average Group Size

Countries

Guest Lifetime Value

Étape 16 — Méthodes

calculateRepeatGuestRate()
 
analyzeGuestOrigins()
 
calculateGuestLTV()

Étape 17 — CRM

Alimenter

Customer Score

Customer Segment

Loyalty Program

Sprint 5-E.1-G

Reservation Performance


Étape 18 — ReservationPerformanceService

Créer

reservation-performance.service.ts

Calculer

Booking Conversion

Booking Velocity

Reservation Growth

Channel Performance

Forecast Accuracy

Étape 19 — Classements

Identifier

Best Performing Properties

Best Channels

Best Markets

Étape 20 — KPI Score

Construire

Booking Score

Revenue Score

Guest Score

Cancellation Score

Global Reservation Score

Sprint 5-E.1-H

Dashboard Principal


Étape 21 — ReservationDashboardService

Créer

reservation-dashboard.service.ts

Agréger

Bookings

Revenue

Guests

Cancellations

Performance

Étape 22 — Endpoint

Ajouter

GET /reservations/dashboard

Étape 23 — Exemple

Réponse

{
  "bookings":842,
  "revenue":125000,
  "cancellationRate":4.2,
  "repeatGuests":31,
  "bookingScore":89
}

Sprint 5-E.1-I

API Analytics


Étape 24 — Endpoints

Ajouter

GET /reservations/dashboard
 
GET /reservations/analytics/bookings
 
GET /reservations/analytics/revenue
 
GET /reservations/analytics/cancellations
 
GET /reservations/analytics/guests
 
GET /reservations/analytics/performance

Étape 25 — Filtres

Supporter

Today

7 Days

30 Days

90 Days

12 Months

Custom Range

Étape 26 — Export

Ajouter

GET /reservations/analytics/export

Formats :

CSV

Excel

PDF

Sprint 5-E.1-J

Gouvernance


Étape 27 — Permissions

Ajouter

reservation.analytics.read

reservation.analytics.export

reservation.analytics.kpi

reservation.analytics.admin

Étape 28 — Audit

Journaliser

RESERVATION_DASHBOARD_VIEWED

BOOKING_ANALYTICS_VIEWED

REVENUE_KPI_CALCULATED

CANCELLATION_ANALYTICS_VIEWED

ANALYTICS_EXPORTED

Étape 29 — Jobs

Ajouter

Toutes les heures

KPI Refresh

Toutes les nuits

Analytics Snapshot

Forecast Refresh

Préparation Sprint 5-E.2

Compatible avec :

Fraud Detection

Revenue Forecast

Reservation Intelligence

Predictive Booking

Définition de terminé

Le Sprint 5-E.1 est terminé lorsque :

✓ Reservation Dashboard

✓ Booking Analytics

✓ Revenue KPIs

✓ Cancellation Analytics

✓ Guest Analytics

✓ Reservation Performance

✓ Export Analytics

✓ Audit intégré

Livrables

ReservationAnalyticsSnapshot

ReservationKPI

ReservationDashboardService

BookingAnalyticsService

RevenueKPIService

CancellationAnalyticsService

GuestAnalyticsService

ReservationPerformanceService

Reservation Analytics Platform

Sprint 5-E.2 — Reservation Intelligence & Analytics Prédictifs

Objectif

Transformer le moteur analytique de réservation en plateforme Reservation Intelligence Enterprise.

Cette couche permet :

Prévision

Détection de fraude

Prédiction d'annulation

Analyse de risque

Optimisation des revenus

Pilotage intelligent

À l'issue de cette étape :

✓ Prévision réservations

✓ Prévision revenus

✓ Fraud Detection

✓ Cancellation Prediction

✓ Guest Risk Score

✓ Reservation Health Score

✓ Reservation Intelligence Platform

Architecture cible

Reservation Analytics

↓

Reservation Intelligence Engine

├── Booking Forecast
├── Revenue Forecast
├── Cancellation Prediction
├── Fraud Detection
├── Guest Risk Scoring
├── Health Scoring
└── AI Recommendations

↓

Revenue Management

↓

Executive Intelligence

Sprint 5-E.2-A

Extension Prisma


Étape 1 — ReservationForecast

Ajouter dans schema.prisma

model ReservationForecast {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  forecastType          ReservationForecastType
 
  forecastDate          DateTime
 
  predictedValue        Float
 
  confidenceScore       Float?
 
  generatedAt           DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([forecastType])
 
  @@index([forecastDate])
}

Étape 2 — ReservationInsight

Ajouter

model ReservationInsight {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  category              ReservationInsightCategory
 
  severity              InsightSeverity
 
  title                 String
 
  description           String
 
  recommendation        String?
 
  impactScore           Float?
 
  resolved              Boolean
                        @default(false)
 
  createdAt             DateTime
                        @default(now())
 
  @@index([tenantId])
 
  @@index([category])
 
  @@index([resolved])
}

Étape 3 — GuestRiskScore

Ajouter

model GuestRiskScore {
 
  guestId               String
                        @id
 
  overallRisk           Float
 
  fraudRisk             Float
 
  cancellationRisk      Float
 
  paymentRisk           Float
 
  behaviorRisk          Float
 
  calculatedAt          DateTime
                        @updatedAt
}

Étape 4 — ReservationHealthScore

Ajouter

model ReservationHealthScore {
 
  reservationId         String
                        @id
 
  overallScore          Float
 
  paymentScore          Float
 
  guestScore            Float
 
  fraudScore            Float
 
  completionScore       Float
 
  calculatedAt          DateTime
                        @updatedAt
}

Étape 5 — Enums

Ajouter

enum ReservationForecastType {
 
  BOOKINGS
 
  REVENUE
 
  CANCELLATIONS
 
  OCCUPANCY
}
 
enum ReservationInsightCategory {
 
  BOOKINGS
 
  REVENUE
 
  CANCELLATION
 
  FRAUD
 
  GUEST
}

Étape 6 — Migration

Générer

npx prisma migrate dev \
--name reservation_intelligence

Sprint 5-E.2-B

Intelligence Module


Étape 7 — Création

src/modules/reservation-intelligence

├── forecasts
│
├── fraud
│
├── cancellation
│
├── risk
│
├── insights
│
├── health-score
│
└── reservation-intelligence.module.ts

Étape 8 — Services

Créer

BookingForecastService

RevenueForecastService

CancellationPredictionService

FraudDetectionService

GuestRiskScoreService

ReservationHealthScoreService

ReservationInsightService

Sprint 5-E.2-C

Prévision des Réservations


Étape 9 — BookingForecastService

Créer

booking-forecast.service.ts

Méthodes

forecastBookings()
 
forecastOccupancyImpact()
 
forecastSeasonality()

Étape 10 — Sources

Utiliser

Reservations

Property Analytics

Seasonality

Events

Historical Trends

Étape 11 — Exemple

30 prochains jours

Prévision

+18%

Réservations

Sprint 5-E.2-D

Prévision des Revenus


Étape 12 — RevenueForecastService

Créer

revenue-forecast.service.ts

Méthodes

forecastRevenue()
 
forecastADR()
 
forecastRevPAR()
 
forecastCashFlow()

Étape 13 — Alimenter

avec :

Reservations

Invoices

Payments

Refunds

Étape 14 — Exemple

Revenue Forecast

145 000 €

+11%

Sprint 5-E.2-E

Prédiction d'Annulation


Étape 15 — CancellationPredictionService

Créer

cancellation-prediction.service.ts

Méthodes

predictCancellation()
 
calculateCancellationRisk()
 
recommendRetentionAction()

Étape 16 — Variables

Utiliser

Lead Time

Country

Booking Source

Past Behavior

Price Sensitivity

Étape 17 — Exemple

Reservation

#RSV-1001

Cancellation Risk

72%

Étape 18 — Actions

Recommander

Reminder

Special Offer

Deposit Request

Sprint 5-E.2-F

Fraud Detection


Étape 19 — FraudDetectionService

Créer

fraud-detection.service.ts

Détecter

Card Fraud

Identity Fraud

Chargeback Risk

Multi Account Abuse

Bot Activity

Étape 20 — Méthodes

calculateFraudRisk()
 
detectSuspiciousPatterns()
 
triggerFraudAlert()

Étape 21 — Sources

Utiliser

Payments

Guest Verification

Connection History

Behavior Analysis

Étape 22 — Alertes

Générer

LOW

MEDIUM

HIGH

CRITICAL

Sprint 5-E.2-G

Guest Risk Score


Étape 23 — GuestRiskScoreService

Créer

guest-risk-score.service.ts

Calcul

Fraude

Paiement

Historique

Annulations

Incidents

Étape 24 — Classification

0-25    Low Risk

26-50   Moderate

51-75   High

76-100  Critical

Étape 25 — Exemple

Guest Risk

18

Low Risk

Sprint 5-E.2-H

Reservation Health Score


Étape 26 — ReservationHealthScoreService

Créer

reservation-health-score.service.ts

Calcul

Payment Status      30%

Guest Risk          25%

Fraud Risk          20%

Workflow Progress   15%

Communication       10%

Étape 27 — Classification

90-100 Excellent

75-89 Healthy

50-74 At Risk

0-49 Critical

Étape 28 — Exemple

Reservation Health

91

Excellent

Sprint 5-E.2-I

Insights IA


Étape 29 — ReservationInsightService

Créer

reservation-insight.service.ts

Générer

Opportunités revenus

Risques annulation

Segments performants

Canaux performants

Alertes fraude

Étape 30 — Exemple

Les réservations Airbnb

↑ 24%

↓

Renforcer ce canal

Étape 31 — Exemple

Les annulations augmentent

sur les réservations >60 jours

↓

Adapter la politique

Sprint 5-E.2-J

Dashboard Intelligence


Étape 32 — Endpoints

Ajouter

GET /reservations/intelligence
 
GET /reservations/forecasts
 
GET /reservations/insights
 
GET /reservations/fraud
 
GET /reservations/health-score
 
GET /guests/{id}/risk-score

Étape 33 — Réponse

Exemple

{
  "bookingForecast":1240,
  "revenueForecast":145000,
  "cancellationRisk":12,
  "fraudAlerts":2,
  "healthScore":91
}

Étape 34 — Analytics IA

Mesurer

Forecast Accuracy

Fraud Detection Rate

Cancellation Prediction Accuracy

Health Score Trends

Insight Adoption

Gouvernance


Étape 35 — Permissions

Ajouter

reservation.intelligence.read

reservation.intelligence.forecast

reservation.intelligence.fraud

reservation.intelligence.health

reservation.intelligence.admin

Étape 36 — Audit

Journaliser

FORECAST_GENERATED

FRAUD_ALERT_TRIGGERED

CANCELLATION_RISK_CALCULATED

GUEST_RISK_UPDATED

HEALTH_SCORE_UPDATED

INTELLIGENCE_DASHBOARD_VIEWED

Étape 37 — Jobs

Ajouter

Toutes les heures

Fraud Detection

Toutes les nuits

Forecast Generation

Risk Recalculation

Insight Generation

Clôture Sprint 5

À la fin du Sprint 5, la plateforme dispose désormais de :

✓ Reservation Engine

✓ Booking Workflow

✓ Payment Platform

✓ Invoicing Platform

✓ Digital Check-In

✓ Digital Check-Out

✓ Service Desk

✓ Housekeeping

✓ Maintenance

✓ Reservation Analytics

✓ Reservation Intelligence

Préparation Sprint 6

Compatible avec :

Multi Property Management

Portfolio Management

Owners

Operators

Asset Management

Préparation Sprint 20

Compatible avec :

Enterprise Hospitality OS

AI Revenue Platform

Predictive Operations

Global Reservation Intelligence

Définition de terminé

Le Sprint 5-E.2 est terminé lorsque :

✓ Prévision réservations

✓ Prévision revenus

✓ Fraud Detection

✓ Cancellation Prediction

✓ Guest Risk Score

✓ Reservation Health Score

✓ Insights IA

✓ Dashboard Intelligence

Livrables

ReservationForecast

ReservationInsight

GuestRiskScore

ReservationHealthScore

BookingForecastService

RevenueForecastService

CancellationPredictionService

FraudDetectionService

GuestRiskScoreService

ReservationHealthScoreService

ReservationInsightService

Reservation Intelligence Platform
DokuWiki Appliance - Powered by TurnKey Linux