feat: implement alias strategy for receipt import with user-scoped and global fallback, enhance validation and normalization, and update UI components
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -2,6 +2,8 @@ class ReceiptAlias {
|
||||
final int id;
|
||||
final String receiptName;
|
||||
final int productId;
|
||||
final int? ownerId;
|
||||
final bool isGlobal;
|
||||
final String? productName;
|
||||
final String? productCanonicalName;
|
||||
|
||||
@@ -9,10 +11,14 @@ class ReceiptAlias {
|
||||
required this.id,
|
||||
required this.receiptName,
|
||||
required this.productId,
|
||||
required this.ownerId,
|
||||
required this.isGlobal,
|
||||
this.productName,
|
||||
this.productCanonicalName,
|
||||
});
|
||||
|
||||
bool get isPrivate => !isGlobal;
|
||||
|
||||
String get displayProductName {
|
||||
final canonical = productCanonicalName?.trim();
|
||||
if (canonical != null && canonical.isNotEmpty) return canonical;
|
||||
@@ -33,6 +39,8 @@ class ReceiptAlias {
|
||||
productId: (json['productId'] as num?)?.toInt() ??
|
||||
(productMap['id'] as num?)?.toInt() ??
|
||||
0,
|
||||
ownerId: (json['ownerId'] as num?)?.toInt(),
|
||||
isGlobal: json['isGlobal'] == true,
|
||||
productName: productMap['name']?.toString(),
|
||||
productCanonicalName: productMap['canonicalName']?.toString(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user