Skip to content

Commit 00ba8be

Browse files
Merge pull request #42 from CommerceBear/unambiguous-filter
Fix ambiguous query on filter
2 parents f71f9dc + 88b7fa1 commit 00ba8be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/convert-filter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ const convertFilter = (filter) => {
1919
}
2020
return {
2121
[Op.and]: [
22-
where(fn('LOWER', col(property.name())), { [Op.like]: fn('LOWER', `%${escape(value)}%`) }),
22+
...(memo[Op.and] || []),
23+
where(
24+
fn('LOWER', col(`${property.sequelizePath.Model.name}.${property.name()}`)),
25+
Op.like,
26+
fn('LOWER', `%${escape(value)}%`),
27+
),
2328
],
2429
...memo,
2530
}

0 commit comments

Comments
 (0)