chore: optimizes demo and version operations
This commit is contained in:
@@ -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);
|
||||
|
||||
// /////////////////////////////////////
|
||||
|
||||
@@ -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);
|
||||
|
||||
// /////////////////////////////////////
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user