From 6ff2d77a323498ce29ec63bf170c37393e52d598 Mon Sep 17 00:00:00 2001 From: JulianAlcala Date: Tue, 12 May 2026 04:05:12 -0500 Subject: [PATCH] added filters to getPositionHistory and getLastPosition in location feature --- .../data/datasource/location_remote_datasource_impl.dart | 2 ++ .../lib/src/legacy_device_remote_datasource_impl.dart | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/legacy/modules/location/lib/src/core/data/datasource/location_remote_datasource_impl.dart b/modules/legacy/modules/location/lib/src/core/data/datasource/location_remote_datasource_impl.dart index 79bf4802..65c176f5 100644 --- a/modules/legacy/modules/location/lib/src/core/data/datasource/location_remote_datasource_impl.dart +++ b/modules/legacy/modules/location/lib/src/core/data/datasource/location_remote_datasource_impl.dart @@ -121,6 +121,8 @@ class LocationRemoteDatasourceImpl implements LocationRemoteDatasource { final filters = encodeFilters([ {'field': 'positionDate', 'operator': 'gte', 'value': fromMs}, {'field': 'positionDate', 'operator': 'lte', 'value': toMs}, + {'field': 'ignore', 'operator': 'eq', 'value': false}, + {'field': 'suspect', 'operator': 'eq', 'value': false}, ]); final orderBy = encodeOrderBy('positionDate', direction: 'ASC'); diff --git a/modules/legacy/packages/legacy_device_state/lib/src/legacy_device_remote_datasource_impl.dart b/modules/legacy/packages/legacy_device_state/lib/src/legacy_device_remote_datasource_impl.dart index c459f8cd..1eeb87d3 100644 --- a/modules/legacy/packages/legacy_device_state/lib/src/legacy_device_remote_datasource_impl.dart +++ b/modules/legacy/packages/legacy_device_state/lib/src/legacy_device_remote_datasource_impl.dart @@ -12,6 +12,10 @@ class LegacyDeviceRemoteDatasourceImpl implements LegacyDeviceRemoteDatasource { Future> getLatestPositions({ required String deviceId, }) async { + final filters = encodeFilters([ + {'field': 'ignore', 'operator': 'eq', 'value': false}, + {'field': 'suspect', 'operator': 'eq', 'value': false}, + ]); try { final response = await _repository.get>( '/devices/identificator/$deviceId/positions', @@ -19,6 +23,7 @@ class LegacyDeviceRemoteDatasourceImpl implements LegacyDeviceRemoteDatasource { 'page': 1, 'pageSize': 1, 'orderBy': encodeOrderBy('positionDate'), + 'filters': filters, }, ); @@ -36,9 +41,7 @@ class LegacyDeviceRemoteDatasourceImpl implements LegacyDeviceRemoteDatasource { } @override - Future getPositionById({ - required String positionId, - }) async { + Future getPositionById({required String positionId}) async { try { final response = await _repository.get>( '/positions/$positionId',