edit tag model keys to integrate with backend

This commit is contained in:
raf-dev1
2025-06-10 10:08:49 +03:00
parent ca02de2093
commit 1d30c753f5

View File

@ -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(),
};
}
}