feat: add initial query support to ProductPickerField and enhance ParsedReceiptItem with categorySuggestionPath
This commit is contained in:
@@ -14,6 +14,7 @@ class ParsedReceiptItem {
|
||||
final String? suggestedProductName;
|
||||
// AI-kategorisuggestion (premium)
|
||||
final String? categorySuggestionName;
|
||||
final String? categorySuggestionPath;
|
||||
|
||||
ParsedReceiptItem({
|
||||
required this.rawName,
|
||||
@@ -27,19 +28,24 @@ class ParsedReceiptItem {
|
||||
this.suggestedProductId,
|
||||
this.suggestedProductName,
|
||||
this.categorySuggestionName,
|
||||
this.categorySuggestionPath,
|
||||
});
|
||||
|
||||
factory ParsedReceiptItem.fromJson(Map<String, dynamic> json) => ParsedReceiptItem(
|
||||
rawName: json['rawName'] as String? ?? '',
|
||||
quantity: (json['quantity'] as num?)?.toDouble(),
|
||||
unit: json['unit'] as String?,
|
||||
price: (json['price'] as num?)?.toDouble(),
|
||||
brand: json['brand'] as String?,
|
||||
origin: json['origin'] as String?,
|
||||
matchedProductId: (json['matchedProductId'] as num?)?.toInt(),
|
||||
matchedProductName: json['matchedProductName'] as String?,
|
||||
suggestedProductId: (json['suggestedProductId'] as num?)?.toInt(),
|
||||
suggestedProductName: json['suggestedProductName'] as String?,
|
||||
categorySuggestionName: (json['categorySuggestion'] as Map<String, dynamic>?)?['categoryName'] as String?,
|
||||
);
|
||||
factory ParsedReceiptItem.fromJson(Map<String, dynamic> json) {
|
||||
final cat = json['categorySuggestion'] as Map<String, dynamic>?;
|
||||
return ParsedReceiptItem(
|
||||
rawName: json['rawName'] as String? ?? '',
|
||||
quantity: (json['quantity'] as num?)?.toDouble(),
|
||||
unit: json['unit'] as String?,
|
||||
price: (json['price'] as num?)?.toDouble(),
|
||||
brand: json['brand'] as String?,
|
||||
origin: json['origin'] as String?,
|
||||
matchedProductId: (json['matchedProductId'] as num?)?.toInt(),
|
||||
matchedProductName: json['matchedProductName'] as String?,
|
||||
suggestedProductId: (json['suggestedProductId'] as num?)?.toInt(),
|
||||
suggestedProductName: json['suggestedProductName'] as String?,
|
||||
categorySuggestionName: cat?['categoryName'] as String?,
|
||||
categorySuggestionPath: cat?['path'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user