From 2435b968cc5059cd69fde8d00f9a8e617771a26d Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 24 Feb 2026 23:50:32 +0100 Subject: [PATCH] fix: seed smoke test product to unblock OG image verification --- scripts/seed-payload.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/seed-payload.ts b/scripts/seed-payload.ts index 242354df..6e49c855 100644 --- a/scripts/seed-payload.ts +++ b/scripts/seed-payload.ts @@ -30,6 +30,33 @@ async function seed() { console.log(`ℹ️ Database already contains ${totalDocs} users. Skipping user creation.`); } + // Check if any products exist + const { totalDocs: totalProducts } = await payload.find({ + collection: 'products', + limit: 1, + }); + + if (totalProducts === 0) { + console.log('📦 No products found. Creating smoke test product (NAY2Y)...'); + await payload.create({ + collection: 'products', + data: { + title: 'NAY2Y Smoke Test', + sku: 'SMOKE-TEST-001', + slug: 'nay2y', + description: 'A dummy product for CI/CD smoke testing and OG image verification.', + locale: 'de', + categories: [{ category: 'Power Cables' }], + _status: 'published', + }, + }); + console.log('✅ Smoke test product created successfully.'); + } else { + console.log( + `ℹ️ Database already contains ${totalProducts} products. Skipping product creation.`, + ); + } + console.log('✅ PayloadCMS seed completed successfully!'); process.exit(0); } catch (error) {