admin user able to create test txs
This commit is contained in:
@@ -88,6 +88,7 @@ class BankTransaction {
|
||||
required this.amount,
|
||||
required this.currency,
|
||||
required this.pending,
|
||||
this.isManual = false,
|
||||
});
|
||||
|
||||
final String date;
|
||||
@@ -96,6 +97,9 @@ class BankTransaction {
|
||||
final String currency;
|
||||
final bool pending;
|
||||
|
||||
/// Admin-created test row (editable / deletable); not from bank feed or CSV.
|
||||
final bool isManual;
|
||||
|
||||
/// Stable local key used for per-occurrence annotations.
|
||||
String get id => '$date|$currency|$amount|$description';
|
||||
|
||||
@@ -109,6 +113,33 @@ class BankTransaction {
|
||||
/// Exact match for copying notes (same description + amount + currency).
|
||||
String get exactKey => '$descriptionKey|$amount|$currency';
|
||||
|
||||
BankTransaction copyWith({
|
||||
String? date,
|
||||
String? description,
|
||||
double? amount,
|
||||
String? currency,
|
||||
bool? pending,
|
||||
bool? isManual,
|
||||
}) {
|
||||
return BankTransaction(
|
||||
date: date ?? this.date,
|
||||
description: description ?? this.description,
|
||||
amount: amount ?? this.amount,
|
||||
currency: currency ?? this.currency,
|
||||
pending: pending ?? this.pending,
|
||||
isManual: isManual ?? this.isManual,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'date': date,
|
||||
'description': description,
|
||||
'amount': amount,
|
||||
'currency': currency,
|
||||
'pending': pending,
|
||||
if (isManual) 'isManual': true,
|
||||
};
|
||||
|
||||
factory BankTransaction.fromJson(Map<String, dynamic> json) {
|
||||
final rawAmount = json['amount'];
|
||||
final amount = switch (rawAmount) {
|
||||
@@ -122,6 +153,9 @@ class BankTransaction {
|
||||
amount: amount,
|
||||
currency: json['currency'] as String? ?? 'EUR',
|
||||
pending: json['pending'] as bool? ?? false,
|
||||
isManual: json['isManual'] as bool? ??
|
||||
json['is_manual'] as bool? ??
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user