import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js' import { devUser } from '../credentials.js' export default buildConfigWithDefaults({ collections: [ { slug: 'posts', fields: [ { name: 'title', type: 'text', required: true, }, { name: 'throwAfterChange', type: 'checkbox', defaultValue: false, hooks: { afterChange: [ ({ value }) => { if (value) { throw new Error('throw after change') } }, ], }, }, ], }, { slug: 'relation-a', fields: [ { name: 'relationship', type: 'relationship', relationTo: 'relation-b', }, { name: 'richText', type: 'richText', }, ], labels: { plural: 'Relation As', singular: 'Relation A', }, }, { slug: 'relation-b', fields: [ { name: 'relationship', type: 'relationship', relationTo: 'relation-a', }, { name: 'richText', type: 'richText', }, ], labels: { plural: 'Relation Bs', singular: 'Relation B', }, }, ], onInit: async (payload) => { await payload.create({ collection: 'users', data: { email: devUser.email, password: devUser.password, }, }) }, }) export const postDoc = { title: 'test post', }