diff --git a/lib/pages/spaces_management/all_spaces/model/tag.dart b/lib/pages/spaces_management/all_spaces/model/tag.dart index 8959986c..a7ec1e15 100644 --- a/lib/pages/spaces_management/all_spaces/model/tag.dart +++ b/lib/pages/spaces_management/all_spaces/model/tag.dart @@ -23,10 +23,13 @@ class Tag extends BaseTag { final String internalId = json['internalId'] ?? const Uuid().v4(); return Tag( - uuid: json['uuid'] ?? '', + //TODO:insure UUId for tag or prodAlloc + uuid: json['name'] != null ? json['uuid'] : json['tag']?['uuid'] ?? '', internalId: internalId, - tag: json['name'] ?? '', - product: json['product'] != null ? ProductModel.fromMap(json['product']) : null, + tag: json['name'] ?? json['tag']?['name'] ?? '', + product: json['product'] != null + ? ProductModel.fromMap(json['product']) + : null, ); } @@ -49,9 +52,10 @@ class Tag extends BaseTag { Map toJson() { return { - 'uuid': uuid, - 'tag': tag, - 'product': product?.toMap(), + if (uuid != null) 'uuid': uuid, + 'name': tag, + 'productUuid': product?.uuid, + // .toMap(), }; } }