refactor schedule view and cleaning

This commit is contained in:
ashrafzarkanisala
2024-09-22 20:47:34 +03:00
parent b3d891b2c8
commit 3a28f0ef9a
21 changed files with 1540 additions and 902 deletions

View File

@ -195,6 +195,29 @@ class DevicesManagementApi {
}
}
Future<List<ScheduleModel>> getDeviceSchedules(
String uuid, String category) async {
try {
final response = await HTTPService().get(
path: ApiEndpoints.scheduleByDeviceId
.replaceAll('{deviceUuid}', uuid)
.replaceAll('{category}', category),
showServerMessage: true,
expectedResponseModel: (json) {
List<ScheduleModel> schedules = [];
for (var schedule in json['schedules']) {
schedules.add(ScheduleModel.fromJson(schedule));
}
return schedules;
},
);
return response;
} catch (e) {
debugPrint('Error fetching $e');
return [];
}
}
Future<bool> updateScheduleRecord(
{required bool enable,
required String uuid,