mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
edit tag model keys to integrate with backend
This commit is contained in:
@ -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<String, dynamic> toJson() {
|
||||
return {
|
||||
'uuid': uuid,
|
||||
'tag': tag,
|
||||
'product': product?.toMap(),
|
||||
if (uuid != null) 'uuid': uuid,
|
||||
'name': tag,
|
||||
'productUuid': product?.uuid,
|
||||
// .toMap(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user