From 534b5bb05a021488fac049abc411590caebc6976 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 12 Feb 2024 11:26:00 +0100 Subject: [PATCH] fix: refs #6106 where filter --- modules/route/back/methods/route/getTickets.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index d1ebf9ee7..59ba389ed 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -1,5 +1,5 @@ -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const {ParameterizedSQL} = require('loopback-connector'); module.exports = Self => { Self.remoteMethod('getTickets', { @@ -83,13 +83,15 @@ module.exports = Self => { const where = filter.where; where['r.id'] = filter.id; + where.and = [{or: [ + {'t.packages': {gt: 0}}, + {and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]} + ]}]; stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeGroupBy('t.id')); stmt.merge(conn.makeOrderBy(filter.order)); - const tickets = await conn.executeStmt(stmt, myOptions); - - return tickets; + return conn.executeStmt(stmt, myOptions); }; };