added position elements to space

This commit is contained in:
hannathkadher
2024-10-08 11:39:10 +04:00
parent cdd22f8d76
commit 081d6fd65f
8 changed files with 342 additions and 198 deletions

View File

@ -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
};
}
}