x
This commit is contained in:
1 parent
913cbef765
commit
173c583787
22 files changed
+2847
-364
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "ProductDetailSection" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"productId" INTEGER NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"order" INTEGER NOT NULL,
|
||||
"payload" JSONB NOT NULL,
|
||||
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
||||
"isLocked" BOOLEAN NOT NULL DEFAULT false,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "ProductDetailSection_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ProductDetailSection_productId_order_idx" ON "ProductDetailSection"("productId", "order");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ProductDetailSection_productId_isActive_idx" ON "ProductDetailSection"("productId", "isActive");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ProductDetailSection" ADD CONSTRAINT "ProductDetailSection_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -67,6 +67,7 @@ model Product {
|
||||
images ProductImage[]
|
||||
attributes ProductAttribute[]
|
||||
reviews Review[]
|
||||
detailSections ProductDetailSection[]
|
||||
translations ProductTranslation[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -631,6 +632,22 @@ model PageSection {
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model ProductDetailSection {
|
||||
id Int @id @default(autoincrement())
|
||||
productId Int
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
type String
|
||||
order Int
|
||||
payload Json
|
||||
isActive Boolean @default(true)
|
||||
isLocked Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([productId, order])
|
||||
@@index([productId, isActive])
|
||||
}
|
||||
|
||||
model NewsletterSubscription {
|
||||
id Int @id @default(autoincrement())
|
||||
email String @unique
|
||||
|
||||
@@ -322,12 +322,22 @@ async function main() {
|
||||
}
|
||||
}
|
||||
});
|
||||
// Editorial banner at the bottom of Product Details
|
||||
// Native product detail hero block
|
||||
await prisma.pageSection.create({
|
||||
data: {
|
||||
pageId: productDetailPage.id,
|
||||
type: "PRODUCT_MAIN",
|
||||
order: 2,
|
||||
isActive: true,
|
||||
payload: {}
|
||||
}
|
||||
});
|
||||
// Editorial banner can now be reordered between native product blocks
|
||||
await prisma.pageSection.create({
|
||||
data: {
|
||||
pageId: productDetailPage.id,
|
||||
type: "EDITORIAL_TILE",
|
||||
order: 2,
|
||||
order: 3,
|
||||
isActive: true,
|
||||
payload: {
|
||||
title: "The [Botanical] Sourcing",
|
||||
@@ -341,6 +351,31 @@ async function main() {
|
||||
}
|
||||
}
|
||||
});
|
||||
await prisma.pageSection.createMany({
|
||||
data: [
|
||||
{
|
||||
pageId: productDetailPage.id,
|
||||
type: "PRODUCT_DETAILS",
|
||||
order: 4,
|
||||
isActive: true,
|
||||
payload: { title: "Product Details", showHeading: true },
|
||||
},
|
||||
{
|
||||
pageId: productDetailPage.id,
|
||||
type: "PRODUCT_SPECS",
|
||||
order: 5,
|
||||
isActive: true,
|
||||
payload: { title: "Specifications", showHeading: true },
|
||||
},
|
||||
{
|
||||
pageId: productDetailPage.id,
|
||||
type: "RELATED_PRODUCTS",
|
||||
order: 6,
|
||||
isActive: true,
|
||||
payload: { title: "Related Products", showHeading: true, showViewAllLink: true },
|
||||
},
|
||||
],
|
||||
});
|
||||
// 7. Create FAQ Page Layout
|
||||
const faqPage = await prisma.page.upsert({
|
||||
where: { slug: "faq-layout" },
|
||||
@@ -659,4 +694,4 @@ main()
|
||||
await prisma.$disconnect();
|
||||
await pool.end();
|
||||
});
|
||||
//# sourceMappingURL=seed-pages.js.map
|
||||
//# sourceMappingURL=seed-pages.js.map
|
||||
@@ -363,9 +363,20 @@ async function main() {
|
||||
await prisma.pageSection.create({
|
||||
data: {
|
||||
pageId: productDetailPage.id,
|
||||
type: "EDITORIAL_TILE",
|
||||
type: "PRODUCT_MAIN",
|
||||
order: 2,
|
||||
isActive: true,
|
||||
payload: {}
|
||||
}
|
||||
});
|
||||
|
||||
// Editorial banner can now be reordered between native product blocks
|
||||
await prisma.pageSection.create({
|
||||
data: {
|
||||
pageId: productDetailPage.id,
|
||||
type: "EDITORIAL_TILE",
|
||||
order: 3,
|
||||
isActive: true,
|
||||
payload: {
|
||||
title: "The [Botanical] Sourcing",
|
||||
description: "All our raw materials are sustainably harvested at peak potency from verified organic micro-farms worldwide.",
|
||||
@@ -379,6 +390,32 @@ async function main() {
|
||||
}
|
||||
});
|
||||
|
||||
await prisma.pageSection.createMany({
|
||||
data: [
|
||||
{
|
||||
pageId: productDetailPage.id,
|
||||
type: "PRODUCT_DETAILS",
|
||||
order: 4,
|
||||
isActive: true,
|
||||
payload: { title: "Product Details", showHeading: true },
|
||||
},
|
||||
{
|
||||
pageId: productDetailPage.id,
|
||||
type: "PRODUCT_SPECS",
|
||||
order: 5,
|
||||
isActive: true,
|
||||
payload: { title: "Specifications", showHeading: true },
|
||||
},
|
||||
{
|
||||
pageId: productDetailPage.id,
|
||||
type: "RELATED_PRODUCTS",
|
||||
order: 6,
|
||||
isActive: true,
|
||||
payload: { title: "Related Products", showHeading: true, showViewAllLink: true },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// 7. Create FAQ Page Layout
|
||||
const faqPage = await prisma.page.upsert({
|
||||
where: { slug: "faq-layout" },
|
||||
|
||||
Reference in new issue
Block a user