diff --git a/back/methods/postcode/filter.js b/back/methods/postcode/filter.js index 2ea70e15a..4c3fc0cd3 100644 --- a/back/methods/postcode/filter.js +++ b/back/methods/postcode/filter.js @@ -1,6 +1,5 @@ const {ParameterizedSQL} = require('loopback-connector'); -const {buildFilter, mergeFilters} = require('vn-loopback/util/filter'); -// const {models} = require('vn-loopback/server/server'); +const {buildFilter} = require('vn-loopback/util/filter'); module.exports = Self => { Self.remoteMethod('filter', { @@ -41,12 +40,13 @@ module.exports = Self => { const where = buildFilter(filter?.where, (param, value) => { switch (param) { case 'search': - return {or: [ - {'pc.code': {like: `%${value}%`}}, - {'t.name': {like: `%${value}%`}}, - {'p.name': {like: `%${value}%`}}, - {'c.country': {like: `%${value}%`}} - ] + return { + or: [ + {'pc.code': {like: `%${value}%`}}, + {'t.name': {like: `%${value}%`}}, + {'p.name': {like: `%${value}%`}}, + {'c.country': {like: `%${value}%`}} + ] }; } }) ?? {};