mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-11 15:47:44 +00:00
updated api
This commit is contained in:
@ -2,9 +2,8 @@ import 'dart:ui';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/community_model.dart';
|
||||
|
||||
class SpaceModel {
|
||||
final String uuid;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
final String? uuid;
|
||||
final String? icon;
|
||||
final String? spaceTuyaUuid;
|
||||
final String name;
|
||||
final bool isPrivate;
|
||||
@ -12,31 +11,26 @@ class SpaceModel {
|
||||
final SpaceModel? parent;
|
||||
final CommunityModel? community;
|
||||
final List<SpaceModel> children;
|
||||
final String? icon;
|
||||
Offset position;
|
||||
bool isHovered;
|
||||
|
||||
SpaceModel({
|
||||
required this.uuid,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.uuid,
|
||||
this.spaceTuyaUuid,
|
||||
required this.icon,
|
||||
required this.name,
|
||||
required this.isPrivate,
|
||||
this.invitationCode,
|
||||
this.parent,
|
||||
this.community,
|
||||
required this.children,
|
||||
required this.icon,
|
||||
required this.position,
|
||||
this.isHovered = false,
|
||||
});
|
||||
|
||||
factory SpaceModel.fromJson(Map<String, dynamic> json) {
|
||||
return SpaceModel(
|
||||
uuid: json['uuid'],
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
updatedAt: DateTime.parse(json['updatedAt']),
|
||||
uuid: json['uuid'] ?? '',
|
||||
spaceTuyaUuid: json['spaceTuyaUuid'],
|
||||
name: json['spaceName'],
|
||||
isPrivate: json['isPrivate'] ?? false,
|
||||
@ -46,11 +40,11 @@ class SpaceModel {
|
||||
community: json['community'] != null
|
||||
? CommunityModel.fromJson(json['community'])
|
||||
: null,
|
||||
children: json['children'] != null
|
||||
? (json['children'] as List)
|
||||
.map((child) => SpaceModel.fromJson(child))
|
||||
.toList()
|
||||
: [],
|
||||
children: json['children'] != null
|
||||
? (json['children'] as List)
|
||||
.map((child) => SpaceModel.fromJson(child))
|
||||
.toList()
|
||||
: [],
|
||||
icon: json['icon'] as String?,
|
||||
position: json['position'] != null
|
||||
? Offset(json['position']['dx'], json['position']['dy'])
|
||||
@ -61,9 +55,7 @@ class SpaceModel {
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'uuid': uuid,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'updatedAt': updatedAt.toIso8601String(),
|
||||
'uuid': uuid ?? '',
|
||||
'spaceTuyaUuid': spaceTuyaUuid,
|
||||
'name': name,
|
||||
'isPrivate': isPrivate,
|
||||
|
Reference in New Issue
Block a user