Files
payload/test/versions/globals/Draft.ts
2023-09-01 14:45:41 -04:00

48 lines
820 B
TypeScript

import type { GlobalConfig } from '../../../packages/payload/src/globals/config/types'
import { draftGlobalSlug } from '../shared'
const DraftGlobal: GlobalConfig = {
slug: draftGlobalSlug,
label: 'Draft Global',
admin: {
preview: () => 'https://payloadcms.com',
},
versions: {
max: 20,
drafts: true,
},
access: {
read: ({ req: { user } }) => {
if (user) {
return true
}
return {
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
}
},
},
fields: [
{
name: 'title',
type: 'text',
required: true,
localized: true,
},
],
}
export default DraftGlobal