76 lines
1.6 KiB
TypeScript
76 lines
1.6 KiB
TypeScript
import { buildConfigWithDefaults } from '../buildConfigWithDefaults';
|
|
import AutosavePosts from './collections/Autosave';
|
|
import DraftPosts from './collections/Drafts';
|
|
import AutosaveGlobal from './globals/Autosave';
|
|
import { devUser } from '../credentials';
|
|
import DraftGlobal from './globals/Draft';
|
|
import VersionPosts from './collections/Versions';
|
|
import { draftSlug } from './shared';
|
|
|
|
export default buildConfigWithDefaults({
|
|
collections: [
|
|
AutosavePosts,
|
|
DraftPosts,
|
|
VersionPosts,
|
|
],
|
|
globals: [
|
|
AutosaveGlobal,
|
|
DraftGlobal,
|
|
],
|
|
localization: {
|
|
locales: ['en', 'es'],
|
|
defaultLocale: 'en',
|
|
},
|
|
indexSortableFields: true,
|
|
onInit: async (payload) => {
|
|
await payload.create({
|
|
collection: 'users',
|
|
data: {
|
|
email: devUser.email,
|
|
password: devUser.password,
|
|
},
|
|
});
|
|
|
|
const { id: draftID } = await payload.create({
|
|
collection: draftSlug,
|
|
draft: true,
|
|
data: {
|
|
id: 1,
|
|
title: 'draft title',
|
|
description: 'draft description',
|
|
radio: 'test',
|
|
},
|
|
});
|
|
|
|
await payload.create({
|
|
collection: draftSlug,
|
|
draft: false,
|
|
data: {
|
|
id: 2,
|
|
title: 'published title',
|
|
description: 'published description',
|
|
radio: 'test',
|
|
_status: 'published',
|
|
},
|
|
});
|
|
|
|
await payload.update({
|
|
collection: draftSlug,
|
|
id: draftID,
|
|
draft: true,
|
|
data: {
|
|
title: 'draft title 2',
|
|
},
|
|
});
|
|
|
|
await payload.update({
|
|
collection: draftSlug,
|
|
id: draftID,
|
|
draft: true,
|
|
data: {
|
|
title: 'draft title 3',
|
|
},
|
|
});
|
|
},
|
|
});
|