Merge pull request #2532 from payloadcms/fix/#2521

fix: #2521, graphql AND not working with drafts
This commit is contained in:
James Mikrut
2023-04-24 09:59:44 -04:00
committed by GitHub

View File

@@ -2,10 +2,10 @@ import { Where } from '../../types';
export const appendVersionToQueryKey = (query: Where): Where => {
return Object.entries(query).reduce((res, [key, val]) => {
if (['and', 'or'].includes(key) && Array.isArray(val)) {
if (['and', 'or', 'AND', 'OR'].includes(key) && Array.isArray(val)) {
return {
...res,
[key]: val.map((subQuery) => appendVersionToQueryKey(subQuery)),
[key.toLowerCase()]: val.map((subQuery) => appendVersionToQueryKey(subQuery)),
};
}