Files
payloadcms/test/field-perf/config.ts
2024-03-19 01:15:25 -04:00

97 lines
2.3 KiB
TypeScript

import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
export default buildConfigWithDefaults({
collections: [
{
slug: 'blocks-collection',
fields: [
{
name: 'layout',
type: 'blocks',
blocks: [
{
slug: 'content',
fields: [
{
name: 'richText',
type: 'richText',
},
{
name: 'field1',
type: 'text',
},
{
name: 'field2',
type: 'text',
},
{
name: 'field3',
type: 'text',
},
{
name: 'field4',
type: 'text',
},
{
name: 'field5',
type: 'text',
},
{
name: 'field6',
type: 'text',
},
{
name: 'field7',
type: 'text',
},
{
name: 'field8',
type: 'text',
},
{
name: 'field9',
type: 'text',
},
],
},
],
},
],
},
],
onInit: async (payload) => {
await payload.create({
collection: 'users',
data: {
email: devUser.email,
password: devUser.password,
},
})
await payload.create({
collection: 'blocks-collection',
data: {
layout: [...Array(100)].map((row, i) => ({
blockName: `Block ${i}`,
blockType: 'content',
richText: [
{
children: [{ text: '' }],
},
],
field1: 'text field 1',
field2: 'text field 2',
field3: 'text field 3',
field4: 'text field 4',
field5: 'text field 5',
field6: 'text field 6',
field7: 'text field 7',
field8: 'text field 8',
field9: 'text field 9',
})),
},
})
},
})