 Support filtering location points by deviceId

This commit is contained in:
Fabio Manganiello 2025-03-26 22:08:37 +01:00
parent 71b954d51d
commit 70ba053016
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -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();