added filters to getPositionHistory and getLastPosition in location feature
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -12,6 +12,10 @@ class LegacyDeviceRemoteDatasourceImpl implements LegacyDeviceRemoteDatasource {
|
||||
Future<List<PositionEntity>> 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<Map<String, dynamic>>(
|
||||
'/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<PositionEntity?> getPositionById({
|
||||
required String positionId,
|
||||
}) async {
|
||||
Future<PositionEntity?> getPositionById({required String positionId}) async {
|
||||
try {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'/positions/$positionId',
|
||||
|
||||
Reference in New Issue
Block a user