Documentation complete de tous les modeles definis dans packages/db/prisma/schema.prisma.
Organisation multi-tenant supportant differents types.
| Champ | Type | Description |
|---|
id | String @id @default(cuid()) | Cle primaire |
type | OrganizationType | PLATFORM, STUDIO, CLIENT, RETOUCHER |
name | String | Nom d'affichage |
slug | String @unique | Identifiant URL-friendly |
parentOrganizationId | String? | Support hierarchique |
locale | String @default("fr-FR") | Locale par defaut |
timezone | String @default("Europe/Paris") | Fuseau horaire |
stripeCustomerId | String? @unique | Integration Stripe |
billingEmail | String? | Email de facturation |
createdAt | DateTime | Date de creation |
updatedAt | DateTime | Date de mise a jour |
Relations : guidelineFiles, invitations, invoices, parent, children, profile, settings, payments, projectsAsClient, projectsAsStudio, retouchAssignments, retouchCategories, users, activeSessions, integrations, notifications, importJobs, clientPricings, studioClientPricings
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String @unique | FK vers Organization |
notificationPrefs | Json | Preferences de notification |
storageLimitsGb | Int @default(500) | Limite de stockage en Go |
autoArchiveDays | Int @default(180) | Jours avant auto-archivage |
studioBranding | Json? | Configuration branding studio |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String @unique | FK vers Organization |
contactName | String? | Nom du contact |
contactEmail | String? | Email du contact |
contactPhone | String? | Telephone du contact |
addressLine1 | String? | Adresse ligne 1 |
addressLine2 | String? | Adresse ligne 2 |
addressPostalCode | String? | Code postal |
addressCity | String? | Ville |
addressCountry | String? | Pays |
billingAddressLine1 | String? | Adresse facturation ligne 1 |
billingAddressLine2 | String? | Adresse facturation ligne 2 |
billingAddressPostalCode | String? | Code postal facturation |
billingAddressCity | String? | Ville facturation |
billingAddressCountry | String? | Pays facturation |
siren | String? | Numero SIREN |
avatarUrl | String? | URL avatar |
studioStatus | String? | Statut studio |
clientStatus | String? | Statut client |
retoucherStatus | String? | Statut retoucheur |
tags | String[] | Tags |
projectsCount | Int @default(0) | Compteur projets |
source | OrganizationSource? | Source (SYSTEM, PENNYLANE) |
sourceId | String? | ID source externe |
tradeName | String? | Nom commercial |
vatNumber | String? | Numero TVA |
downloadAuthorization | DownloadAuthorization @default(LOW) | Niveau d'autorisation telechargement |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
email | String @unique | Email unique |
displayName | String | Nom d'affichage |
passwordHash | String? | Hash mot de passe |
emailVerified | Boolean @default(false) | Verification email |
mfaEnabled | Boolean @default(false) | MFA active |
locale | String? @default("fr-FR") | Preference locale |
lastLoginAt | DateTime? | Derniere connexion |
avatarUrl | String? | URL avatar |
role | String? | Role global |
banned | Boolean? @default(false) | Banni |
banReason | String? | Raison du ban |
banExpires | DateTime? | Expiration du ban |
deletedAt | DateTime? | Suppression logique |
Relations : Asset, comments, invitations, legalConsents, RetouchVersion, UploadSession, organizations, workflowEvents, notifications, Account, Session, downloadEvents
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
email | String | Email invite |
token | String @unique | Token unique |
expiresAt | DateTime | Expiration |
usedAt | DateTime? | Date d'utilisation |
organizationId | String | FK vers Organization |
role | UserRole | Role attribue |
userId | String? | FK vers User (si existant) |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
userId | String | FK vers User |
organizationId | String | FK vers Organization |
role | UserRole | Niveau de permission |
scopes | String[] | Permissions additionnelles |
defaultContext | Json? | Contexte par defaut |
Contrainte unique : [userId, organizationId]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
reference | String @unique | Reference unique |
name | String | Nom du projet |
studioId | String | FK vers Organization (studio) |
clientId | String | FK vers Organization (client) |
workflowState | ProjectWorkflowState @default(STUDIO_REVIEW) | Etat courant |
retouchEnabled | Boolean @default(true) | Retouche activee |
retouchingCategory | RetouchingCategory? | Categorie de retouche |
guidelineFileId | String? | FK vers GuidelineFile |
currentRoundNumber | Int @default(0) | Numero round courant |
metadata | Json | Metadonnees |
visibility | String @default("studio_only") | Visibilite |
shootingDate | DateTime | Date de shooting |
kickoffDate | DateTime? | Date de kickoff |
deadlineDate | DateTime? | Date limite |
archivedAt | DateTime? | Date d'archivage |
downloadUnlocked | Boolean @default(false) | Telechargement debloque |
quoteStatus | QuoteStatus @default(DRAFT) | Statut du devis |
paymentStatus | PaymentStatus @default(UNPAID) | Statut paiement |
isPublic | Boolean @default(false) | Projet public |
publicToken | String? @unique | Token public |
ftpBasePath | String? | Chemin FTP de base |
billingCurrency | String? | Devise facturation |
billingPricingModel | String? | Modele de tarification |
billingClientUnitPrice | Int? | Prix unitaire client |
billingEstimatedTotalRevenue | Int? | Revenu estime total |
billingRetoucherUnitPrice | Int? | Prix unitaire retoucheur |
billingEstimatedTotalCost | Int? | Cout estime total |
billingEstimatedMargin | Int? | Marge estimee |
billingEstimatedMarginPercent | Float? | Pourcentage marge |
priceMatchType | PriceMatchType? | Type de correspondance prix |
guidelinePricingCategoryId | String? | FK vers GuidelinePricingCategory |
agreedPriceCents | Int? | Prix convenu en centimes |
Relations : assets, comments, invoice, payments, client, guidelineFile, studio, pricingItems, retouchVendors, retouchRounds, uploadSessions, workflowEvents, notifications, ftpSyncJobs, downloadEvents
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
organizationId | String | FK vers Organization |
status | String @default("pending") | Statut |
assignedAt | DateTime | Date d'assignation |
releasedAt | DateTime? | Date de liberation |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
uploaderId | String | FK vers User |
assetType | AssetType @default(PHOTO) | Type (PHOTO, VIDEO, DOCUMENT) |
status | AssetStatus @default(UPLOADING) | Statut de traitement |
storageKey | String @unique | Cle de stockage R2 |
originalUrl | String? | URL fichier original |
previewUrl | String? | URL preview |
thumbnailUrl | String? | URL miniature |
sizeInBytes | BigInt? | Taille du fichier |
sku | String? | SKU produit |
view | String? | Type de vue |
viewIndex | Int? | Index de vue |
variation | String? | Variation |
extraFormat | String? | Format supplementaire |
priority | Int @default(0) | Priorite |
isHighEndRetouch | Boolean @default(false) | Retouche high-end |
isSelected | Boolean @default(false) | Selection client |
clientValidationStatus | ClientValidationStatus @default(PENDING) | Statut validation |
format | String? | Format de fichier |
uploadedAt | DateTime | Date d'upload |
deliveredAt | DateTime? | Date de livraison |
deletedAt | DateTime? | Suppression logique |
metadata | Json | Metadonnees |
Relations : project, uploader, comments, invoiceItems, retouchVersions, uploadSessions
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String | FK vers Organization |
name | String | Nom de la guideline |
category | GuidelineCategory | Categorie |
filePath | String | Chemin stockage |
fileName | String | Nom du fichier |
extension | String | Extension |
sizeInBytes | BigInt? | Taille |
view | String | Type de vue |
imageSpecifications | Json? | Specifications image |
referenceImages | Json? | Images de reference |
Relations : organization, guidelineOrganizationPrices, GuidelinePricingCategory, projects
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
roundNumber | Int | Numero de round |
status | String @default("pending") | Statut |
startedAt | DateTime? | Date de debut |
completedAt | DateTime? | Date de fin |
Contrainte unique : [projectId, roundNumber]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
roundId | String | FK vers RetouchRound |
assetId | String | FK vers Asset |
filePath | String | Chemin fichier |
previewUrl | String? | URL preview |
thumbnailUrl | String? | URL miniature |
uploadedById | String | FK vers User |
status | String @default("pending") | Statut |
feedback | String? | Feedback |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
assetId | String? | FK vers Asset (optionnel) |
authorId | String | FK vers User |
body | String | Contenu du commentaire |
context | Json? | Contexte (annotations, position) |
repliedToId | String? | FK vers Comment parent |
deletedAt | DateTime? | Suppression logique |
Relations : asset, author, project, parent, replies
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
actorId | String | FK vers User |
fromState | ProjectWorkflowState? | Etat source |
toState | ProjectWorkflowState | Etat cible |
message | String? | Message |
metadata | Json? | Metadonnees |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
type | String | Type de notification |
title | String | Titre |
message | String | Message |
payload | Json? | Donnees additionnelles |
organizationId | String? | FK vers Organization |
projectId | String? | FK vers Project |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
notificationId | String | FK vers Notification |
userId | String | FK vers User |
channel | NotificationChannel @default(IN_APP) | Canal |
status | String @default("pending") | Statut livraison |
deliveredAt | DateTime? | Date de livraison |
readAt | DateTime? | Date de lecture |
Contrainte unique : [notificationId, userId, channel]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String | FK vers Organization |
projectId | String @unique | FK vers Project (1:1) |
stripeInvoiceId | String? @unique | ID Stripe |
stripePaymentIntentId | String? @unique | PaymentIntent Stripe |
stripeCheckoutSessionId | String? @unique | CheckoutSession Stripe |
stripeInvoiceUrl | String? | URL facture Stripe |
stripeInvoicePdf | String? | URL PDF Stripe |
stripeHostedUrl | String? | URL hebergee Stripe |
totalCents | Int | Total en centimes |
subtotalCents | Int | Sous-total |
taxCents | Int @default(0) | Taxes |
currency | String @default("EUR") | Devise |
status | InvoiceStatus @default(DRAFT) | Statut |
dueDate | DateTime? | Date d'echeance |
paidAt | DateTime? | Date de paiement |
voidedAt | DateTime? | Date d'annulation |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
invoiceId | String | FK vers Invoice |
description | String | Description |
quantity | Int @default(1) | Quantite |
unitPriceCents | Int | Prix unitaire |
totalCents | Int | Total |
currency | String @default("EUR") | Devise |
assetId | String? | FK vers Asset |
metadata | Json? | Metadonnees |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String | FK vers Organization |
projectId | String | FK vers Project |
invoiceId | String? | FK vers Invoice |
stripePaymentIntentId | String? @unique | PaymentIntent Stripe |
stripeChargeId | String? | Charge ID Stripe |
status | PaymentStatus @default(PENDING) | Statut |
amountCents | Int | Montant en centimes |
currency | String @default("EUR") | Devise |
paymentMethod | String? | Methode de paiement |
failureCode | String? | Code erreur |
failureMessage | String? | Message erreur |
receiptUrl | String? | URL recu |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
categoryId | String? | FK vers RetouchCategory |
label | String? | Label |
clientUnitPriceCents | Int | Prix unitaire client |
retoucherUnitPriceCents | Int | Prix unitaire retoucheur |
quantity | Int | Quantite |
totalClientPriceCents | Int | Total client |
totalRetoucherCostCents | Int | Total retoucheur |
vatRatePercent | Float @default(20.0) | Taux TVA |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String | FK vers Organization |
code | String | Code unique par org |
label | String | Label |
description | String? | Description |
isActive | Boolean @default(true) | Actif |
Contrainte unique : [organizationId, code]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
studioId | String | FK vers Organization (studio) |
clientId | String | FK vers Organization (client) |
categoryId | String? | FK vers RetouchCategory |
label | String? | Label |
clientUnitPriceCents | Int | Prix unitaire client |
vatRatePercent | Float @default(20.0) | Taux TVA |
currency | String @default("EUR") | Devise |
Contrainte unique : [studioId, clientId, categoryId]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
assetId | String? | FK vers Asset |
createdById | String | FK vers User |
provider | String @default("r2") | Provider de stockage |
presignedUrl | String | URL presignee |
expiresAt | DateTime | Expiration |
completedAt | DateTime? | Date de completion |
status | String @default("pending") | Statut |
metadata | Json? | Metadonnees |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
token | String @unique | Token de session |
userId | String | FK vers User |
expiresAt | DateTime | Expiration |
activeOrganizationId | String? | Organisation active |
impersonatedBy | String? | Admin usurpateur |
ipAddress | String? | Adresse IP |
userAgent | String? | User Agent |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
userId | String | FK vers User |
providerId | String | ID provider OAuth |
accountId | String | ID compte externe |
accessToken | String? | Token d'acces |
refreshToken | String? | Token de rafraichissement |
accessTokenExpiresAt | DateTime? | Expiration token |
tokenType | String? | Type de token |
scope | String? | Scopes |
Contrainte unique : [providerId, accountId]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String | FK vers Organization |
type | ImportJobType | PENNYLANE_CUSTOMERS |
status | ImportJobStatus @default(PENDING) | Statut |
totalItems | Int? | Total elements |
processedItems | Int @default(0) | Elements traites |
importedItems | Int @default(0) | Elements importes |
skippedItems | Int @default(0) | Elements ignores |
failedItems | Int @default(0) | Elements en erreur |
config | Json? | Configuration |
lastCursor | String? | Dernier curseur |
errorMessage | String? | Message d'erreur |
completedAt | DateTime? | Date de completion |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
integrationId | String | ID integration |
direction | FtpSyncDirection | PUSH ou PULL |
folderType | FtpSyncFolderType | RAW ou RETOUCHED |
status | FtpSyncStatus @default(PENDING) | Statut |
filesTotal | Int @default(0) | Fichiers total |
filesProcessed | Int @default(0) | Fichiers traites |
filesSkipped | Int @default(0) | Fichiers ignores |
errorMessage | String? | Message d'erreur |
completedAt | DateTime? | Date de completion |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
projectId | String | FK vers Project |
userId | String | FK vers User |
assetIds | String[] | IDs des assets telecharges |
assetCount | Int | Nombre d'assets |
downloadType | String | Type de telechargement |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
userId | String | FK vers User |
invitationId | String? | FK vers Invitation |
document | LegalDocumentType | TERMS_OF_USE ou PRIVACY_POLICY |
version | String | Version du document |
locale | String? @default("fr") | Locale |
acceptedAt | DateTime | Date d'acceptation |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
guidelineId | String | FK vers GuidelineFile |
name | String | Nom de la categorie |
basePriceCents | Int | Prix de base |
retoucherBasePriceCents | Int @default(0) | Prix retoucheur de base |
currency | String @default("EUR") | Devise |
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
guidelineId | String | FK vers GuidelineFile |
organizationId | String | FK vers Organization |
guidelinePricingCategoryId | String? | FK vers GuidelinePricingCategory |
priceCents | Int | Prix en centimes |
currency | String @default("EUR") | Devise |
Contrainte unique : [guidelineId, organizationId, guidelinePricingCategoryId]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
studioId | String | FK vers Organization |
category | RetouchingCategory | Categorie de retouche |
unitPriceCents | Int | Prix unitaire |
currency | String @default("EUR") | Devise |
Contrainte unique : [studioId, category]
| Champ | Type | Description |
|---|
id | String @id | Cle primaire |
organizationId | String | FK vers Organization |
integrationId | String | ID integration |
settings | Json? | Configuration |
Contrainte unique : [organizationId, integrationId]