mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 14:29:41 +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();
|
final String internalId = json['internalId'] ?? const Uuid().v4();
|
||||||
|
|
||||||
return Tag(
|
return Tag(
|
||||||
uuid: json['uuid'] ?? '',
|
//TODO:insure UUId for tag or prodAlloc
|
||||||
|
uuid: json['name'] != null ? json['uuid'] : json['tag']?['uuid'] ?? '',
|
||||||
internalId: internalId,
|
internalId: internalId,
|
||||||
tag: json['name'] ?? '',
|
tag: json['name'] ?? json['tag']?['name'] ?? '',
|
||||||
product: json['product'] != null ? ProductModel.fromMap(json['product']) : null,
|
product: json['product'] != null
|
||||||
|
? ProductModel.fromMap(json['product'])
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,9 +52,10 @@ class Tag extends BaseTag {
|
|||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
'uuid': uuid,
|
if (uuid != null) 'uuid': uuid,
|
||||||
'tag': tag,
|
'name': tag,
|
||||||
'product': product?.toMap(),
|
'productUuid': product?.uuid,
|
||||||
|
// .toMap(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user