31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { getPayload } from 'payload'
|
|
import configPromise from '../src/payload.config'
|
|
|
|
async function run() {
|
|
const payload = await getPayload({ config: configPromise })
|
|
const pages = await payload.find({ collection: 'pages', limit: 100 }) // fetch all locales?
|
|
|
|
const plPages = await payload.find({ collection: 'pages', locale: 'pl', limit: 100 })
|
|
const dePages = await payload.find({ collection: 'pages', locale: 'de', limit: 100 })
|
|
|
|
console.log("=== PL ===")
|
|
plPages.docs.forEach(page => {
|
|
page.layout?.forEach(block => {
|
|
if (block.blockType === 'testimonials' || block.blockType === 'testimonialsGrid') {
|
|
console.log(`Page: ${page.slug}, Block: ${block.blockType}, Items: ${block.testimonials?.length || 0}`)
|
|
}
|
|
})
|
|
})
|
|
|
|
console.log("=== DE ===")
|
|
dePages.docs.forEach(page => {
|
|
page.layout?.forEach(block => {
|
|
if (block.blockType === 'testimonials' || block.blockType === 'testimonialsGrid') {
|
|
console.log(`Page: ${page.slug}, Block: ${block.blockType}, Items: ${block.testimonials?.length || 0}`)
|
|
}
|
|
})
|
|
})
|
|
process.exit(0)
|
|
}
|
|
run()
|