Support filtering location points by deviceId
This commit is contained in:
parent
71b954d51d
commit
70ba053016
1 changed files with 6 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue