fixed edit community

This commit is contained in:
hannathkadher
2024-11-21 16:50:25 +04:00
parent 9be03850a5
commit 6c5b01e7c2
7 changed files with 109 additions and 15 deletions

View File

@ -5,7 +5,7 @@ class CommunityModel {
final String uuid;
final DateTime createdAt;
final DateTime updatedAt;
final String name;
String name;
final String description;
final RegionModel? region;
List<SpaceModel> spaces;
@ -27,12 +27,9 @@ class CommunityModel {
updatedAt: DateTime.parse(json['updatedAt']),
name: json['name'],
description: json['description'],
region:
json['region'] != null ? RegionModel.fromJson(json['region']) : null,
region: json['region'] != null ? RegionModel.fromJson(json['region']) : null,
spaces: json['spaces'] != null
? (json['spaces'] as List)
.map((space) => SpaceModel.fromJson(space))
.toList()
? (json['spaces'] as List).map((space) => SpaceModel.fromJson(space)).toList()
: [],
);
}
@ -45,9 +42,7 @@ class CommunityModel {
'name': name,
'description': description,
'region': region?.toJson(),
'spaces': spaces
.map((space) => space.toMap())
.toList(), // Convert spaces to Map
'spaces': spaces.map((space) => space.toMap()).toList(), // Convert spaces to Map
};
}
}