added community to all device

This commit is contained in:
hannathkadher
2024-10-22 10:12:08 +04:00
parent 03b5c49df0
commit c297e02a84
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,18 @@
class DeviceCommunityModel {
String? uuid;
String? name;
DeviceCommunityModel({this.uuid, this.name});
DeviceCommunityModel.fromJson(Map<String, dynamic> json) {
uuid = json['uuid']?.toString();
name = json['name']?.toString();
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['uuid'] = uuid;
data['name'] = name;
return data;
}
}

View File

@ -1,3 +1,4 @@
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_community.model.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_space_model.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/device_space_model.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
@ -41,6 +42,7 @@ class AllDevicesModel {
DevicesModelRoom? room; DevicesModelRoom? room;
DevicesModelUnit? unit; DevicesModelUnit? unit;
DeviceCommunityModel? community;
String? productUuid; String? productUuid;
String? productType; String? productType;
String? permissionType; String? permissionType;
@ -70,6 +72,7 @@ class AllDevicesModel {
AllDevicesModel({ AllDevicesModel({
this.room, this.room,
this.unit, this.unit,
this.community,
this.productUuid, this.productUuid,
this.productType, this.productType,
this.permissionType, this.permissionType,
@ -103,6 +106,9 @@ class AllDevicesModel {
unit = (json['unit'] != null && (json['unit'] is Map)) unit = (json['unit'] != null && (json['unit'] is Map))
? DevicesModelUnit.fromJson(json['unit']) ? DevicesModelUnit.fromJson(json['unit'])
: null; : null;
community = (json['community'] != null && (json['community'] is Map))
? DeviceCommunityModel.fromJson(json['community'])
: null;
productUuid = json['productUuid']?.toString(); productUuid = json['productUuid']?.toString();
productType = json['productType']?.toString(); productType = json['productType']?.toString();
permissionType = json['permissionType']?.toString(); permissionType = json['permissionType']?.toString();
@ -170,6 +176,9 @@ class AllDevicesModel {
if (unit != null) { if (unit != null) {
data['unit'] = unit!.toJson(); data['unit'] = unit!.toJson();
} }
if (community != null) {
data['community'] = community!.toJson();
}
data['productUuid'] = productUuid; data['productUuid'] = productUuid;
data['productType'] = productType; data['productType'] = productType;
data['permissionType'] = permissionType; data['permissionType'] = permissionType;