mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 07:14:56 +00:00
added position elements to space
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:syncrow_web/pages/auth/model/region_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/space_model.dart';
|
||||
|
||||
class CommunityModel {
|
||||
final String uuid;
|
||||
@ -7,6 +8,7 @@ class CommunityModel {
|
||||
final String name;
|
||||
final String description;
|
||||
final RegionModel? region;
|
||||
List<SpaceModel> spaces;
|
||||
|
||||
CommunityModel({
|
||||
required this.uuid,
|
||||
@ -14,6 +16,7 @@ class CommunityModel {
|
||||
required this.updatedAt,
|
||||
required this.name,
|
||||
required this.description,
|
||||
required this.spaces,
|
||||
this.region,
|
||||
});
|
||||
|
||||
@ -26,6 +29,11 @@ class CommunityModel {
|
||||
description: json['description'],
|
||||
region:
|
||||
json['region'] != null ? RegionModel.fromJson(json['region']) : null,
|
||||
spaces: json['spaces'] != null
|
||||
? (json['spaces'] as List)
|
||||
.map((space) => SpaceModel.fromJson(space))
|
||||
.toList()
|
||||
: [],
|
||||
);
|
||||
}
|
||||
|
||||
@ -37,6 +45,9 @@ class CommunityModel {
|
||||
'name': name,
|
||||
'description': description,
|
||||
'region': region?.toJson(),
|
||||
'spaces': spaces
|
||||
.map((space) => space.toMap())
|
||||
.toList(), // Convert spaces to Map
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user