Skip to content

Commit 8724d0e

Browse files
authored
fix: allow to filter by uuid
1 parent 709cfed commit 8724d0e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/convert-filter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import escape from 'escape-regexp';
22
import { Op } from 'sequelize';
33

4+
const uuidRegex = /^[0-9A-F]{8}-[0-9A-F]{4}-[5|4|3|2|1][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
5+
46
const convertFilter = (filter) => {
57
if (!filter) {
68
return {};
@@ -13,7 +15,7 @@ const convertFilter = (filter) => {
1315
const previousValue = memo[property.name()] || {};
1416
switch (property.type()) {
1517
case 'string': {
16-
if (property.sequelizePath.values) {
18+
if (property.sequelizePath.values || uuidRegex.test(value.toString())) {
1719
return {
1820
[property.name()]: { [Op.eq]: `${escape(value)}` },
1921
...memo,

0 commit comments

Comments
 (0)