fix: seed smoke test product to unblock OG image verification
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / ♿ WCAG (push) Has been cancelled
Build & Deploy / 🛡️ Quality Gates (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled

This commit is contained in:
2026-02-24 23:50:32 +01:00
parent b6a1ebd236
commit 2435b968cc

View File

@@ -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) {