Outils pour utilisateurs

Outils du site


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

Ceci est une ancienne révision du document !


Sprint 7-A.1 — Distribution Core & Channel Management

Objectif

Mettre en place le socle de distribution multi-canaux Enterprise.

Cette couche permet de connecter les propriétés aux différents canaux de vente :

OTA

Site Web

Application Mobile

Partenaires

Marketplaces

Channel Managers

afin de centraliser la gestion :

Inventaire

Tarification

Disponibilités

Synchronisation

Distribution

À l'issue de cette étape :

✓ Channel

✓ ChannelConnection

✓ ChannelMapping

✓ DistributionRule

✓ ChannelInventory

✓ ChannelPricing

✓ Distribution Core Platform

Architecture cible

Properties

↓

Distribution Core

├── Channels
├── Connections
├── Mapping
├── Inventory
├── Pricing
└── Rules Engine

↓

OTA / Marketplace

↓

Reservations

Sprint 7-A.1-A

Extension Prisma


Étape 1 — Channel

Ajouter dans schema.prisma

model Channel {
 
  id                    String
                        @id
                        @default(uuid())
 
  code                  String
                        @unique
 
  name                  String
 
  category              ChannelCategory
 
  provider              String
 
  active                Boolean
                        @default(true)
 
  supportsInventory     Boolean
                        @default(true)
 
  supportsPricing       Boolean
                        @default(true)
 
  supportsReservations  Boolean
                        @default(true)
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  connections           ChannelConnection[]
 
  @@index([category])
 
  @@index([active])
}

Étape 2 — ChannelConnection

Ajouter

model ChannelConnection {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  channelId             String
 
  portfolioId           String?
 
  connectionName        String
 
  externalAccountId     String?
 
  status                ChannelConnectionStatus
 
  credentials           Json?
 
  lastSyncAt            DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  channel               Channel
                        @relation(
                          fields:[channelId],
                          references:[id]
                        )
 
  @@index([tenantId])
 
  @@index([channelId])
 
  @@index([status])
}

Étape 3 — ChannelMapping

Ajouter

model ChannelMapping {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String
 
  channelConnectionId   String
 
  externalPropertyId    String
 
  externalListingId     String?
 
  active                Boolean
                        @default(true)
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  @@index([tenantId])
 
  @@index([propertyId])
 
  @@index([channelConnectionId])
}

Étape 4 — DistributionRule

Ajouter

model DistributionRule {
 
  id                    String
                        @id
                        @default(uuid())
 
  tenantId              String
 
  propertyId            String?
 
  portfolioId           String?
 
  name                  String
 
  priority              Int
                        @default(100)
 
  enabled               Boolean
                        @default(true)
 
  conditions            Json
 
  actions               Json
 
  createdAt             DateTime
                        @default(now())
 
  updatedAt             DateTime
                        @updatedAt
 
  @@index([tenantId])
 
  @@index([enabled])
 
  @@index([priority])
}

Étape 5 — ChannelInventory

Ajouter

model ChannelInventory {
 
  id                    String
                        @id
                        @default(uuid())
 
  propertyId            String
 
  channelMappingId      String
 
  inventoryDate         DateTime
 
  availableUnits        Int
 
  blockedUnits          Int
                        @default(0)
 
  syncedAt              DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@unique([
    channelMappingId,
    inventoryDate
  ])
 
  @@index([propertyId])
 
  @@index([inventoryDate])
}

Étape 6 — ChannelPricing

Ajouter

model ChannelPricing {
 
  id                    String
                        @id
                        @default(uuid())
 
  propertyId            String
 
  channelMappingId      String
 
  pricingDate           DateTime
 
  basePrice             Decimal
                        @db.Decimal(12,2)
 
  adjustedPrice         Decimal?
                        @db.Decimal(12,2)
 
  currency              String
 
  syncedAt              DateTime?
 
  createdAt             DateTime
                        @default(now())
 
  @@unique([
    channelMappingId,
    pricingDate
  ])
 
  @@index([propertyId])
 
  @@index([pricingDate])
}

Étape 7 — Enums

Ajouter

enum ChannelCategory {
 
  OTA
 
  DIRECT
 
  MARKETPLACE
 
  WHOLESALER
 
  CORPORATE
 
  CHANNEL_MANAGER
}
 
enum ChannelConnectionStatus {
 
  PENDING
 
  CONNECTED
 
  ERROR
 
  DISCONNECTED
}

Étape 8 — Migration

npx prisma migrate dev \
--name distribution_core

Sprint 7-A.1-B

Distribution Module


Étape 9 — Structure

src/modules/distribution

├── channels
├── connections
├── mappings
├── inventory
├── pricing
├── rules
└── distribution.module.ts

Étape 10 — Services

ChannelService

ChannelConnectionService

ChannelMappingService

DistributionRuleService

ChannelInventoryService

ChannelPricingService

Sprint 7-A.1-C

Gestion des Canaux


Étape 11 — ChannelService

Créer

channel.service.ts

Canaux supportés

Airbnb

Booking.com

Expedia

Abritel

Direct Website

Mobile App

Étape 12 — Méthodes

getChannels()
 
createChannel()
 
activateChannel()
 
deactivateChannel()

Sprint 7-A.1-D

Gestion des Connexions


Étape 13 — ChannelConnectionService

Créer

channel-connection.service.ts

Méthodes

connectChannel()
 
disconnectChannel()
 
refreshConnection()
 
validateCredentials()

Étape 14 — Sécurité

Stocker

API Keys

OAuth Tokens

Secrets

dans le coffre-fort sécurisé existant.


Sprint 7-A.1-E

Mapping


Étape 15 — ChannelMappingService

Créer

channel-mapping.service.ts

Méthodes

mapProperty()
 
unmapProperty()
 
validateMapping()
 
syncExternalListing()

Étape 16 — Objectif

Associer :

Property

↓

External Listing

sur chaque canal.


Sprint 7-A.1-F

Distribution Rules


Étape 17 — DistributionRuleService

Créer

distribution-rule.service.ts

Supporter

Inventory Rules

Pricing Rules

Channel Restrictions

Priority Rules

Étape 18 — Exemples

Si Occupancy > 90%

↓

+15% prix

Si Channel = OTA

↓

Min Stay = 2 nuits

Sprint 7-A.1-G

Inventory Distribution


Étape 19 — ChannelInventoryService

Créer

channel-inventory.service.ts

Méthodes

syncInventory()
 
pushAvailability()
 
pullAvailability()
 
resolveInventoryConflict()

Étape 20 — Synchronisation

Supporter

Temps réel

Batch

Webhook

Sprint 7-A.1-H

Pricing Distribution


Étape 21 — ChannelPricingService

Créer

channel-pricing.service.ts

Méthodes

syncPricing()
 
pushRates()
 
pullRates()
 
applyChannelMarkup()

Étape 22 — Gestion

Prix base

Prix OTA

Prix Corporate

Prix Promotion

Sprint 7-A.1-I

API Distribution


Étape 23 — Endpoints

GET    /distribution/channels
 
POST   /distribution/channels/connect
 
GET    /distribution/mappings
 
POST   /distribution/mappings
 
GET    /distribution/inventory
 
GET    /distribution/pricing
 
POST   /distribution/rules

Étape 24 — Réponse

{
  "channel":"Booking.com",
  "status":"CONNECTED",
  "mappedProperties":124
}

Étape 25 — Multi-Propriété

Supporter

Portfolio

Property Group

Property

comme niveau de distribution.


Sprint 7-A.1-J

Gouvernance


Étape 26 — Permissions

distribution.read

distribution.connect

distribution.mapping

distribution.inventory

distribution.pricing

distribution.admin

Étape 27 — Audit

CHANNEL_CONNECTED

CHANNEL_DISCONNECTED

PROPERTY_MAPPED

INVENTORY_SYNCED

PRICING_SYNCED

DISTRIBUTION_RULE_CREATED

Étape 28 — Jobs

Toutes les 5 minutes

Inventory Sync

Pricing Sync

Connection Health Check

Préparation Sprint 7-A.2

Compatible avec :

OTA APIs

Webhook Sync

Channel Intelligence

Rate Optimization

Définition de terminé

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

✓ Channel créé

✓ ChannelConnection créé

✓ ChannelMapping créé

✓ DistributionRule créé

✓ ChannelInventory créé

✓ ChannelPricing créé

✓ Distribution Core opérationnel

Livrables

Channel

ChannelConnection

ChannelMapping

DistributionRule

ChannelInventory

ChannelPricing

ChannelService

ChannelConnectionService

ChannelMappingService

DistributionRuleService

ChannelInventoryService

ChannelPricingService

Distribution Core Platform

Étape suivante

Sprint 7-A.2

OTA Integrations & Synchronisation Temps Réel

Objectif :

Implémenter :

Airbnb API

Booking.com API

Expedia API

Webhook Engine

Rate Sync

Availability Sync

afin de connecter la plateforme aux principaux canaux de distribution.

ujusum/3-codage/2-sprints/7-sprint-7.1781136561.txt.gz · Dernière modification : 2026/06/11 02:09 de 83.202.252.200

DokuWiki Appliance - Powered by TurnKey Linux