Files
payloadcms/test/hooks/config.ts
2022-10-24 12:05:12 -04:00

35 lines
983 B
TypeScript

import { buildConfig } from '../buildConfig';
import TransformHooks from './collections/Transform';
import Hooks, { hooksSlug } from './collections/Hook';
import NestedAfterReadHooks from './collections/NestedAfterReadHooks';
import Relations from './collections/Relations';
import Users, { seedHooksUsers } from './collections/Users';
export default buildConfig({
collections: [
TransformHooks,
Hooks,
NestedAfterReadHooks,
Relations,
Users,
],
onInit: async (payload) => {
await seedHooksUsers(payload);
await payload.create({
collection: hooksSlug,
data: {
check: 'update',
fieldBeforeValidate: false,
collectionBeforeValidate: false,
fieldBeforeChange: false,
collectionBeforeChange: false,
fieldAfterChange: false,
collectionAfterChange: false,
collectionBeforeRead: false,
fieldAfterRead: false,
collectionAfterRead: false,
},
});
},
});