mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Add owner and device type filters to device list
Owner filter uses a server-side substring match (LIKE '%VALUE%'); device type filter matches the stored value exactly, sending an empty string for unknown/unclassified devices. Both filters combine with the existing registration status chip via AND logic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
bf74cbb38e
commit
e7d075ec29
@@ -5,6 +5,7 @@ import 'package:encrypter/encrypter/xor.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:frontend/utils/pref_utils.dart';
|
||||
import '../model/device.dart';
|
||||
import '../model/device_type.dart';
|
||||
import '../model/notification.dart';
|
||||
|
||||
class BackendAPI {
|
||||
@@ -90,11 +91,20 @@ class BackendAPI {
|
||||
return Device.fromJson(response.data as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Future<List<Device>> listDevices({bool? isRegistered}) async {
|
||||
Future<List<Device>> listDevices({
|
||||
bool? isRegistered,
|
||||
String? owner,
|
||||
DeviceType? deviceType,
|
||||
}) async {
|
||||
debugPrint('About to call /devices');
|
||||
|
||||
final params = <String, dynamic>{};
|
||||
if (isRegistered != null) params['is_registered'] = isRegistered;
|
||||
if (owner != null && owner.isNotEmpty) params['owner'] = owner;
|
||||
if (deviceType != null) {
|
||||
params['device_type'] =
|
||||
deviceType == DeviceType.unknown ? '' : deviceType.name;
|
||||
}
|
||||
|
||||
final response = await _dio.get('/devices', queryParameters: params);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user