From 70ba0530164a4aad37d0ebcf3f479719e5117aae Mon Sep 17 00:00:00 2001 From: Fabio Manganiello <fabio@manganiello.tech> Date: Wed, 26 Mar 2025 22:08:37 +0100 Subject: [PATCH] =?UTF-8?q?=EF=87=80=20=20Support=20filtering=20location?= =?UTF-8?q?=20points=20by=20deviceId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/requests/LocationRequest.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/requests/LocationRequest.ts b/src/requests/LocationRequest.ts index 48d0e2b..90207d7 100644 --- a/src/requests/LocationRequest.ts +++ b/src/requests/LocationRequest.ts @@ -39,7 +39,7 @@ class LocationRequest { order?: string; }) { this.userId = req.userId; - this.deviceId = req.deviceId; + this.deviceId = req.deviceId?.length ? req.deviceId : this.deviceId; this.initNumber('limit', req); this.initNumber('offset', req); this.initDate('startDate', req); @@ -85,6 +85,11 @@ class LocationRequest { queryMap.offset = this.offset; } + if (this.deviceId != null) { + const deviceIds = this.deviceId.split(/\s*,\s*/); + where[db.locationTableColumns.deviceId || 'deviceId'] = {[Op.in]: deviceIds}; + } + const colMapping: any = db.locationTableColumns if (this.startDate != null || this.endDate != null) { const start = this.startDate == null ? 0 : this.startDate.getTime();