Merge pull request #2532 from payloadcms/fix/#2521
fix: #2521, graphql AND not working with drafts
This commit is contained in:
@@ -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)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user