chore: updates global versions test config

This commit is contained in:
Jacob Fletcher
2023-04-17 13:43:31 -04:00
parent a45ab8bd76
commit 78316d4ddc
2 changed files with 40 additions and 12 deletions

View File

@@ -4,7 +4,9 @@ import { autoSaveGlobalSlug } from '../shared';
const AutosaveGlobal: GlobalConfig = {
slug: autoSaveGlobalSlug,
label: 'Autosave Global',
preview: () => 'https://payloadcms.com',
admin: {
preview: () => 'https://payloadcms.com',
},
versions: {
max: 20,
drafts: {
@@ -12,13 +14,25 @@ const AutosaveGlobal: GlobalConfig = {
},
},
access: {
read: ({ draft, req: { user } }) => {
// To read a draft of this global, you need to be authenticated
if (draft) {
return Boolean(user);
read: ({ req: { user } }) => {
if (user) {
return true;
}
return true;
return {
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
};
},
},
fields: [

View File

@@ -4,19 +4,33 @@ import { draftGlobalSlug } from '../shared';
const DraftGlobal: GlobalConfig = {
slug: draftGlobalSlug,
label: 'Draft Global',
preview: () => 'https://payloadcms.com',
admin: {
preview: () => 'https://payloadcms.com',
},
versions: {
max: 20,
drafts: true,
},
access: {
read: ({ draft, req: { user } }) => {
// To read a draft of this global, you need to be authenticated
if (draft) {
return Boolean(user);
read: ({ req: { user } }) => {
if (user) {
return true;
}
return true;
return {
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
};
},
},
fields: [