ujusum:3-codage:1-repository:2-prisma-schema
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| ujusum:3-codage:1-repository:2-prisma-schema [2026/06/07 05:01] – 91.170.108.99 | ujusum:3-codage:1-repository:2-prisma-schema [2026/06/07 05:27] (Version actuelle) – 91.170.108.99 | ||
|---|---|---|---|
| Ligne 1092: | Ligne 1092: | ||
| ---- | ---- | ||
| - | ====== | + | ====== |
| - | ===== Validation | + | ===== Entités |
| - | < | + | < |
| - | npx prisma format | + | Property |
| - | npx prisma validate | + | PropertyType |
| + | |||
| + | PropertyStatus | ||
| + | |||
| + | PropertyAddress | ||
| + | |||
| + | PropertyFeature | ||
| + | |||
| + | PropertyMedia | ||
| + | |||
| + | PropertyAvailability | ||
| + | |||
| + | PropertyRate | ||
| + | |||
| + | PropertyOwner | ||
| </ | </ | ||
| ---- | ---- | ||
| - | ===== Génération | + | ====== Property ====== |
| + | |||
| + | ===== Table principale ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Property { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyTypeId | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | reference | ||
| + | |||
| + | title | ||
| + | |||
| + | slug String @unique | ||
| + | |||
| + | description | ||
| + | |||
| + | shortDescription | ||
| + | |||
| + | maxGuests | ||
| + | |||
| + | bedrooms | ||
| + | |||
| + | bathrooms | ||
| + | |||
| + | area Decimal? @db.Decimal(10, | ||
| + | |||
| + | floor | ||
| + | |||
| + | constructionYear | ||
| + | |||
| + | checkInTime | ||
| + | |||
| + | checkOutTime | ||
| + | |||
| + | active | ||
| + | |||
| + | published | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | deletedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | propertyType | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | address | ||
| + | |||
| + | features | ||
| + | |||
| + | media | ||
| + | |||
| + | availabilities | ||
| + | |||
| + | rates | ||
| + | |||
| + | owners | ||
| + | |||
| + | reservations | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyType ====== | ||
| + | |||
| + | ===== Référentiel ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyType { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | name String | ||
| + | |||
| + | properties | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Valeurs ===== | ||
| + | |||
| + | < | ||
| + | HOUSE | ||
| + | |||
| + | APARTMENT | ||
| + | |||
| + | VILLA | ||
| + | |||
| + | STUDIO | ||
| + | |||
| + | LOFT | ||
| + | |||
| + | CHALET | ||
| + | |||
| + | COTTAGE | ||
| + | |||
| + | MOBILE_HOME | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyAddress ====== | ||
| + | |||
| + | ===== Adresse du bien ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyAddress { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | addressLine1 | ||
| + | |||
| + | addressLine2 | ||
| + | |||
| + | postalCode | ||
| + | |||
| + | city String | ||
| + | |||
| + | state | ||
| + | |||
| + | countryCode | ||
| + | |||
| + | latitude | ||
| + | |||
| + | longitude | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyFeature ====== | ||
| + | |||
| + | ===== Équipements ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyFeature { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | featureCode | ||
| + | |||
| + | featureValue | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemples ===== | ||
| + | |||
| + | < | ||
| + | POOL | ||
| + | |||
| + | WIFI | ||
| + | |||
| + | PARKING | ||
| + | |||
| + | AIR_CONDITIONING | ||
| + | |||
| + | TERRACE | ||
| + | |||
| + | SEA_VIEW | ||
| + | |||
| + | PET_ALLOWED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyMedia ====== | ||
| + | |||
| + | ===== Médias ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyMedia { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | fileName | ||
| + | |||
| + | fileUrl | ||
| + | |||
| + | mediaType | ||
| + | |||
| + | position | ||
| + | |||
| + | isCover | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== MediaType ===== | ||
| + | |||
| + | < | ||
| + | IMAGE | ||
| + | |||
| + | VIDEO | ||
| + | |||
| + | VIRTUAL_TOUR | ||
| + | |||
| + | DOCUMENT | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyAvailability ====== | ||
| + | |||
| + | ===== Calendrier ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyAvailability { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | startDate | ||
| + | |||
| + | endDate | ||
| + | |||
| + | status | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Enum ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum AvailabilityStatus { | ||
| + | |||
| + | AVAILABLE | ||
| + | |||
| + | RESERVED | ||
| + | |||
| + | BLOCKED | ||
| + | |||
| + | MAINTENANCE | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyRate ====== | ||
| + | |||
| + | ===== Tarification ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyRate { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | startDate | ||
| + | |||
| + | endDate | ||
| + | |||
| + | nightlyRate | ||
| + | |||
| + | weekendRate | ||
| + | |||
| + | cleaningFee | ||
| + | |||
| + | securityDeposit | ||
| + | |||
| + | currencyCode | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== PropertyOwner ====== | ||
| + | |||
| + | ===== Association propriétaire ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PropertyOwner { | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | ownerId | ||
| + | |||
| + | ownershipRate | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | owner Owner @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@id([propertyId, | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Indexes ====== | ||
| + | |||
| + | ===== Property ===== | ||
| + | |||
| + | <code prisma> | ||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyTypeId]) | ||
| + | |||
| + | @@index([published]) | ||
| + | |||
| + | @@index([active]) | ||
| + | |||
| + | @@index([title]) | ||
| + | |||
| + | @@index([slug]) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== PropertyAvailability ===== | ||
| + | |||
| + | <code prisma> | ||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([startDate]) | ||
| + | |||
| + | @@index([endDate]) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== PropertyRate ===== | ||
| + | |||
| + | <code prisma> | ||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([startDate]) | ||
| + | |||
| + | @@index([endDate]) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Domaine Owner ====== | ||
| + | |||
| + | ===== Architecture ===== | ||
| + | |||
| + | < | ||
| + | Owner | ||
| + | |||
| + | OwnerAddress | ||
| + | |||
| + | OwnerDocument | ||
| + | |||
| + | OwnerBankAccount | ||
| + | |||
| + | PropertyOwner | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Owner ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model Owner { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | code String @unique | ||
| + | |||
| + | companyName | ||
| + | |||
| + | firstName | ||
| + | |||
| + | lastName | ||
| + | |||
| + | email | ||
| + | |||
| + | phone | ||
| + | |||
| + | mobile | ||
| + | |||
| + | taxIdentifier | ||
| + | |||
| + | vatNumber | ||
| + | |||
| + | active | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | deletedAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | address | ||
| + | |||
| + | documents | ||
| + | |||
| + | bankAccounts | ||
| + | |||
| + | properties | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== OwnerAddress ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model OwnerAddress { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | ownerId | ||
| + | |||
| + | addressLine1 | ||
| + | |||
| + | addressLine2 | ||
| + | |||
| + | postalCode | ||
| + | |||
| + | city String | ||
| + | |||
| + | state | ||
| + | |||
| + | countryCode | ||
| + | |||
| + | owner Owner @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== OwnerDocument ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model OwnerDocument { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | ownerId | ||
| + | |||
| + | documentType | ||
| + | |||
| + | fileUrl | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | owner Owner @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Document Types ===== | ||
| + | |||
| + | < | ||
| + | IDENTITY | ||
| + | |||
| + | TAX_DOCUMENT | ||
| + | |||
| + | MANDATE | ||
| + | |||
| + | BANK_DETAILS | ||
| + | |||
| + | INSURANCE | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== OwnerBankAccount ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model OwnerBankAccount { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | ownerId | ||
| + | |||
| + | iban String | ||
| + | |||
| + | bic | ||
| + | |||
| + | accountHolder | ||
| + | |||
| + | active | ||
| + | |||
| + | owner Owner @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Domaine Reservation ====== | ||
| + | |||
| + | ===== Architecture ===== | ||
| + | |||
| + | < | ||
| + | Reservation | ||
| + | |||
| + | ReservationGuest | ||
| + | |||
| + | ReservationStatusHistory | ||
| + | |||
| + | ReservationEvent | ||
| + | |||
| + | ReservationPricing | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Reservation ====== | ||
| + | |||
| + | ===== Table centrale ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Reservation { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | customerId | ||
| + | |||
| + | reference | ||
| + | |||
| + | status | ||
| + | |||
| + | checkInDate | ||
| + | |||
| + | checkOutDate | ||
| + | |||
| + | nights | ||
| + | |||
| + | adults | ||
| + | |||
| + | children | ||
| + | |||
| + | infants | ||
| + | |||
| + | totalGuests | ||
| + | |||
| + | notes | ||
| + | |||
| + | source | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | updatedAt | ||
| + | |||
| + | cancelledAt | ||
| + | |||
| + | tenant | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | property | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | guests | ||
| + | |||
| + | events | ||
| + | |||
| + | statusHistory | ||
| + | |||
| + | pricing | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ReservationStatus ====== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ReservationStatus { | ||
| + | |||
| + | DRAFT | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | CONFIRMED | ||
| + | |||
| + | SIGNED | ||
| + | |||
| + | PAID | ||
| + | |||
| + | CHECKED_IN | ||
| + | |||
| + | COMPLETED | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ReservationSource ====== | ||
| + | |||
| + | <code prisma> | ||
| + | enum ReservationSource { | ||
| + | |||
| + | WEBSITE | ||
| + | |||
| + | BACKOFFICE | ||
| + | |||
| + | AIRBNB | ||
| + | |||
| + | BOOKING | ||
| + | |||
| + | VRBO | ||
| + | |||
| + | API | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ReservationGuest ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model ReservationGuest { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | firstName | ||
| + | |||
| + | lastName | ||
| + | |||
| + | birthDate | ||
| + | |||
| + | email | ||
| + | |||
| + | phone | ||
| + | |||
| + | isPrimary | ||
| + | |||
| + | reservation | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ReservationPricing ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model ReservationPricing { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | nightlyAmount | ||
| + | |||
| + | cleaningFee | ||
| + | |||
| + | touristTax | ||
| + | |||
| + | discountAmount | ||
| + | |||
| + | totalAmount | ||
| + | |||
| + | currencyCode | ||
| + | |||
| + | reservation | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ReservationEvent ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model ReservationEvent { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | eventType | ||
| + | |||
| + | payload | ||
| + | |||
| + | createdAt | ||
| + | |||
| + | reservation | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Event Types ===== | ||
| + | |||
| + | < | ||
| + | CREATED | ||
| + | |||
| + | CONFIRMED | ||
| + | |||
| + | SIGNED | ||
| + | |||
| + | PAID | ||
| + | |||
| + | CHECK_IN | ||
| + | |||
| + | CHECK_OUT | ||
| + | |||
| + | CANCELLED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== ReservationStatusHistory ====== | ||
| + | |||
| + | <code prisma> | ||
| + | model ReservationStatusHistory { | ||
| + | |||
| + | id String @id @default(uuid()) | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | previousStatus | ||
| + | |||
| + | newStatus | ||
| + | |||
| + | changedAt | ||
| + | |||
| + | reservation | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Relations à ajouter ====== | ||
| + | |||
| + | ===== Property ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | reservations Reservation[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Tenant ===== | ||
| + | |||
| + | Ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | owners Owner[] | ||
| + | |||
| + | reservations Reservation[] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Indexes ====== | ||
| + | |||
| + | ===== Owner ===== | ||
| + | |||
| + | <code prisma> | ||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([email]) | ||
| + | |||
| + | @@index([active]) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Reservation ===== | ||
| + | |||
| + | <code prisma> | ||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | |||
| + | @@index([checkInDate]) | ||
| + | |||
| + | @@index([checkOutDate]) | ||
| + | |||
| + | @@index([reference]) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ReservationGuest ===== | ||
| + | |||
| + | <code prisma> | ||
| + | @@index([reservationId]) | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Validation ====== | ||
| <code bash> | <code bash> | ||
| + | npx prisma format | ||
| + | |||
| + | npx prisma validate | ||
| + | |||
| npx prisma generate | npx prisma generate | ||
| </ | </ | ||
| Ligne 1112: | Ligne 2014: | ||
| ---- | ---- | ||
| - | ===== Migration ===== | + | ====== Migration |
| <code bash> | <code bash> | ||
| npx prisma migrate dev \ | npx prisma migrate dev \ | ||
| - | --name | + | --name |
| </ | </ | ||
| ---- | ---- | ||
| - | ====== | + | ====== |
| - | À la fin de cette sous-phase, vous disposez déjà de tout le socle nécessaire pour : | + | À ce stade, le noyau fonctionnel est enfin présent |
| < | < | ||
| - | Sprint 1 | + | Tenant |
| - | Authentification | + | User |
| - | JWT | + | Role |
| - | Refresh Token | + | Permission |
| - | RBAC | + | Owner |
| - | + | ||
| - | Profil utilisateur | + | |
| - | Sessions | + | Property |
| - | MFA | + | Reservation |
| </ | </ | ||
| - | ainsi que la base nécessaire au : | + | avec : |
| < | < | ||
| - | Sprint 19 | + | Catalogue Immobilier |
| - | SSO | + | Propriétaires |
| - | Conformité | + | Réservations |
| - | Audit | + | RBAC |
| - | Sécurité Enterprise | + | Multi-tenant |
| </ | </ | ||
| Ligne 1161: | Ligne 2061: | ||
| ====== Étape suivante ====== | ====== Étape suivante ====== | ||
| - | ===== Phase 2-B ===== | + | ===== Phase 2-E ===== |
| - | Référentiels globaux | + | Domaines financiers et contractuels |
| < | < | ||
| - | Country | + | Contract |
| - | Language | + | ContractTemplate |
| - | Currency | + | ContractSignature |
| - | Timezone | + | Document |
| - | Address | + | Payment |
| - | Contact | + | Invoice |
| - | Media | + | Refund |
| - | Document | + | AccountingEntry |
| </ | </ | ||
| - | qui seront réutilisés par pratiquement tous les modules métiers | + | Ces tables permettront d' |
| + | |||
| + | * Sprint 5 — Contrats & Signature Électronique | ||
| + | * Sprint 6 — Paiements & Facturation | ||
| + | |||
| + | et de disposer du premier flux métier complet : | ||
| + | |||
| + | < | ||
| + | Property | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Reservation | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Contract | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Payment | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Invoice | ||
| + | </ | ||
ujusum/3-codage/1-repository/2-prisma-schema.1780801313.txt.gz · Dernière modification : 2026/06/07 05:01 de 91.170.108.99 · Actuellement bloqué par : 192.168.0.100,216.73.216.72