mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
@@ -16,6 +16,7 @@ class Transaction {
|
||||
final DateTime? lastOccurrence;
|
||||
final String currency;
|
||||
final String currencyCode;
|
||||
final int accountId;
|
||||
|
||||
const Transaction({
|
||||
required this.id,
|
||||
@@ -28,6 +29,7 @@ class Transaction {
|
||||
this.lastOccurrence,
|
||||
this.currency = '\$',
|
||||
this.currencyCode = 'USD',
|
||||
required this.accountId,
|
||||
});
|
||||
|
||||
factory Transaction.fromJson(Map<String, dynamic> json) => Transaction(
|
||||
@@ -50,6 +52,7 @@ class Transaction {
|
||||
: null,
|
||||
currency: json['currency'] as String? ?? '\$',
|
||||
currencyCode: json['currencyCode'] as String? ?? 'USD',
|
||||
accountId: json['accountId'] as int,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -63,6 +66,7 @@ class Transaction {
|
||||
'lastOccurrence': lastOccurrence?.toIso8601String(),
|
||||
'currency': currency,
|
||||
'currencyCode': currencyCode,
|
||||
'accountId': accountId,
|
||||
};
|
||||
|
||||
Transaction copyWith({
|
||||
@@ -76,6 +80,7 @@ class Transaction {
|
||||
DateTime? lastOccurrence,
|
||||
String? currency,
|
||||
String? currencyCode,
|
||||
int? accountId,
|
||||
}) =>
|
||||
Transaction(
|
||||
id: id ?? this.id,
|
||||
@@ -88,5 +93,6 @@ class Transaction {
|
||||
lastOccurrence: lastOccurrence ?? this.lastOccurrence,
|
||||
currency: currency ?? this.currency,
|
||||
currencyCode: currencyCode ?? this.currencyCode,
|
||||
accountId: accountId ?? this.accountId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ class StorageService {
|
||||
note: tx.note,
|
||||
recurrence: tx.recurrence,
|
||||
lastOccurrence: today,
|
||||
accountId: tx.accountId,
|
||||
);
|
||||
transactions.add(newTx);
|
||||
|
||||
@@ -248,6 +249,7 @@ class StorageService {
|
||||
lastOccurrence: today,
|
||||
currency: tx.currency,
|
||||
currencyCode: tx.currencyCode,
|
||||
accountId: tx.accountId,
|
||||
);
|
||||
transactions.add(newTx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user