SoftwareBrothers / adminjs-sequelizejs

Sequelizejs adapter for AdminBro
MIT License
27 stars 34 forks source link

Unable to filter enum fields for multiple values #122

Open rlamorea opened 1 year ago

rlamorea commented 1 year ago

If I try a filtered URL like:

https://my.adminjs.server/admin/resources/myresource?filters.enumField=foo&filters.enumField=bar

The query only looks for WHERE enumField = 'foo'

This is because of line 16 in @adminjs/sequelize/lib/utils/convert-filter.js:

 if (property.sequelizePath.values || uuidRegex.test(value.toString())) {

Since it is an enum field, this intercepts before it gets to the check for isArray and returns an Op.eq where clause instead of an Op.in clause.

rlamorea commented 1 year ago

Note that this line would also prevent the selection of multiple UUIDs if I am reading it correctly.