Skip to content

Commit 318501c

Browse files
revert the nor logic
1 parent 4415748 commit 318501c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,16 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => {
312312
fieldValue.forEach((subQuery) => {
313313
const clause = buildWhereClause({ schema, query: subQuery, index });
314314
if (clause.pattern.length > 0) {
315-
if (fieldName === '$nor') {
316-
clause.pattern = `(NOT ${clause.pattern})`;
317-
}
318315
clauses.push(clause.pattern);
319316
clauseValues.push(...clause.values);
320317
index += clause.values.length;
321318
}
322319
});
323-
const orOrAnd = fieldName === '$or' ? ' OR ' : ' AND ';
324-
patterns.push(`(${clauses.join(orOrAnd)})`);
320+
321+
const orOrAnd = fieldName === '$and' ? ' AND ' : ' OR ';
322+
const not = fieldName === '$nor' ? ' NOT ' : '';
323+
324+
patterns.push(`${not}(${clauses.join(orOrAnd)})`);
325325
values.push(...clauseValues);
326326
}
327327

0 commit comments

Comments
 (0)