Files
klz-cables.com/check-data.ts
Marc Mintel a5d77fc69b
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Failing after 1m13s
Build & Deploy / 🏗️ Build (push) Failing after 5m53s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / ♿ WCAG (push) Has been skipped
Build & Deploy / 🛡️ Quality Gates (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
feat: payload cms
2026-02-24 02:28:48 +01:00

40 lines
1.2 KiB
TypeScript

import { getPayload } from 'payload';
import configPromise from '@payload-config';
async function checkData() {
try {
const payload = await getPayload({ config: configPromise });
const { docs: posts } = await payload.find({ collection: 'posts', limit: 3 });
const { docs: products } = await payload.find({ collection: 'products', limit: 3 });
const { docs: pages } = await payload.find({ collection: 'pages', limit: 3 });
const checkDocs = (name: string, docs: any[]) => {
console.log(`\n----- ${name.toUpperCase()} -----`);
docs.forEach((p) => {
console.log(`ID: ${p.id}, Slug: ${p.slug}`);
if (Array.isArray(p.content)) {
console.log(
'Content is ARRAY (Slate format!)',
JSON.stringify(p.content).substring(0, 100),
);
} else if (p.content && p.content.root) {
console.log('Content is Lexical format.');
} else {
console.log('Content is UNKNOWN format.');
console.log(JSON.stringify(p.content).substring(0, 100));
}
});
};
checkDocs('posts', posts);
checkDocs('products', products);
checkDocs('pages', pages);
} catch (err) {
console.error(err);
}
process.exit(0);
}
checkData();