rebours/prisma/schema.prisma
ordinarthur f4ac81dac3 feat: full product management from admin with image upload
- Add @adminjs/upload for image management (JPEG/PNG/WebP, max 5MB)
- Auto-compute imagePath, ogImage, slug, seoTitle, seoDescription
- Stripe price auto-sync on product create/edit
- Serve uploads via Fastify + nginx /uploads/ location
- Add imageKey/imageMime fields to schema
- Hide technical fields from admin edit form
- Add uploads/ and SQLite DB to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 23:38:11 +01:00

76 lines
1.9 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Product {
id String @id @default(cuid())
slug String @unique
sortOrder Int @default(0)
// Card data (data-* attributes)
index String // e.g. "PROJET_001"
name String // e.g. "Solar_Altar"
type String // e.g. "LAMPE DE TABLE"
materials String
year String
status String // e.g. "PROTOTYPE [80%]"
description String
specs String
notes String
imagePath String
imageAlt String @default("")
imageKey String? // upload filename
imageMime String? // upload mime type
// SEO
seoTitle String
seoDescription String
ogImage String
// Commerce
productDisplayName String
price Int? // cents, null = not for sale
currency String @default("EUR")
availability String @default("https://schema.org/PreOrder")
stripePriceId String? // Stripe price_id
stripeKey String? // compat frontend e.g. "lumiere_orbitale"
isPublished Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
orders Order[]
}
model Order {
id String @id @default(cuid())
stripeSessionId String @unique
stripePaymentIntent String?
status String @default("pending")
amount Int
currency String @default("EUR")
customerEmail String?
receiptUrl String?
productId String?
product Product? @relation(fields: [productId], references: [id])
productSlug String?
metadata String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model AdminUser {
id String @id @default(cuid())
email String @unique
passwordHash String
createdAt DateTime @default(now())
}