mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 03:04:55 +00:00
added subspace model events
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class SpaceTemplateModel {
|
||||
final String uuid;
|
||||
@ -6,28 +7,33 @@ class SpaceTemplateModel {
|
||||
final DateTime updatedAt;
|
||||
final String modelName;
|
||||
final bool disabled;
|
||||
final List<SubspaceModel> subspaceModels;
|
||||
final List<SubspaceTemplateModel> subspaceModels;
|
||||
final List<TagModel> tags;
|
||||
String internalId;
|
||||
|
||||
SpaceTemplateModel({
|
||||
required this.uuid,
|
||||
String? internalId,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.modelName,
|
||||
required this.disabled,
|
||||
required this.subspaceModels,
|
||||
required this.tags,
|
||||
});
|
||||
}) : internalId = internalId ?? const Uuid().v4();
|
||||
|
||||
factory SpaceTemplateModel.fromJson(Map<String, dynamic> json) {
|
||||
final String internalId = json['internalId'] ?? const Uuid().v4();
|
||||
|
||||
return SpaceTemplateModel(
|
||||
uuid: json['uuid'] ?? '',
|
||||
internalId: internalId,
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
updatedAt: DateTime.parse(json['updatedAt']),
|
||||
modelName: json['modelName'] ?? '',
|
||||
disabled: json['disabled'] ?? false,
|
||||
subspaceModels: (json['subspaceModels'] as List)
|
||||
.map((item) => SubspaceModel.fromJson(item))
|
||||
.map((item) => SubspaceTemplateModel.fromJson(item))
|
||||
.toList(),
|
||||
tags: (json['tags'] as List)
|
||||
.map((item) => TagModel.fromJson(item))
|
||||
@ -48,28 +54,22 @@ class SpaceTemplateModel {
|
||||
}
|
||||
}
|
||||
|
||||
class SubspaceModel {
|
||||
final String uuid;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
class SubspaceTemplateModel {
|
||||
final String? uuid;
|
||||
final String subspaceName;
|
||||
final bool disabled;
|
||||
final List<TagModel> tags;
|
||||
final List<TagModel>? tags;
|
||||
|
||||
SubspaceModel({
|
||||
required this.uuid,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
SubspaceTemplateModel({
|
||||
this.uuid,
|
||||
required this.subspaceName,
|
||||
required this.disabled,
|
||||
required this.tags,
|
||||
this.tags,
|
||||
});
|
||||
|
||||
factory SubspaceModel.fromJson(Map<String, dynamic> json) {
|
||||
return SubspaceModel(
|
||||
factory SubspaceTemplateModel.fromJson(Map<String, dynamic> json) {
|
||||
return SubspaceTemplateModel(
|
||||
uuid: json['uuid'] ?? '',
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
updatedAt: DateTime.parse(json['updatedAt']),
|
||||
subspaceName: json['subspaceName'] ?? '',
|
||||
disabled: json['disabled'] ?? false,
|
||||
tags: (json['tags'] as List)
|
||||
@ -81,11 +81,9 @@ class SubspaceModel {
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'uuid': uuid,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'updatedAt': updatedAt.toIso8601String(),
|
||||
'subspaceName': subspaceName,
|
||||
'disabled': disabled,
|
||||
'tags': tags.map((e) => e.toJson()).toList(),
|
||||
'tags': tags?.map((e) => e.toJson()).toList() ?? [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user