chore: optimizes demo and version operations

This commit is contained in:
James
2022-02-07 16:11:19 -05:00
parent 7397d63073
commit 0ecd9ff0cb
6 changed files with 14 additions and 42 deletions

View File

@@ -97,23 +97,6 @@ async function find<T extends TypeWithID = any>(incomingArgs: Arguments): Promis
}
}
if (collectionConfig.versions?.drafts && !draftsEnabled) {
queryToBuild.where.and.push({
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
});
}
const query = await Model.buildQuery(queryToBuild, locale);
// /////////////////////////////////////

View File

@@ -81,23 +81,6 @@ async function findByID<T extends TypeWithID = any>(this: Payload, incomingArgs:
queryToBuild.where.and.push(accessResult);
}
if (collectionConfig.versions?.drafts && !draftEnabled) {
queryToBuild.where.and.push({
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
});
}
const query = await Model.buildQuery(queryToBuild, locale);
// /////////////////////////////////////

View File

@@ -201,7 +201,7 @@ async function update<T extends TypeWithID = any>(this: Payload, args): Promise<
});
// /////////////////////////////////////
// afterChange - Collection
// afterChange - Global
// /////////////////////////////////////
await globalConfig.hooks.afterChange.reduce(async (priorHook, hook) => {