fix: appends versions key to incoming where query (#3287)

This commit is contained in:
Jarrod Flesch
2023-09-06 15:07:46 -04:00
committed by GitHub
parent 429a88a5a1
commit 9cd5e5aefa

View File

@@ -124,8 +124,8 @@ const queryDraftsV2 = async <T extends TypeWithID>({
where,
}: Args): Promise<PaginatedDocs<T>> => {
const VersionModel = payload.versions[collection.config.slug] as CollectionModel;
const combinedQuery = combineQueries({ latest: { equals: true } }, where);
const queryWithPrefix = appendVersionToQueryKey(where || {});
const combinedQuery = combineQueries({ latest: { equals: true } }, queryWithPrefix);
const versionsQuery = await VersionModel.buildQuery({
where: combinedQuery,