Updates from idk when...
This commit is contained in:
@@ -10,6 +10,7 @@ class Budget {
|
||||
this.id,
|
||||
required this.familyId,
|
||||
required this.name,
|
||||
required this.expectedIncome,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.hide = false,
|
||||
@@ -17,6 +18,7 @@ class Budget {
|
||||
|
||||
final int? id;
|
||||
final int familyId;
|
||||
final double? expectedIncome;
|
||||
final String name;
|
||||
|
||||
@JsonKey(fromJson: boolFromJson, toJson: boolToJson)
|
||||
|
||||
@@ -10,6 +10,7 @@ Budget _$BudgetFromJson(Map<String, dynamic> json) => Budget(
|
||||
id: json['id'] as int?,
|
||||
familyId: json['family_id'] as int,
|
||||
name: json['name'] as String,
|
||||
expectedIncome: (json['expected_income'] as num?)?.toDouble(),
|
||||
createdAt: dateFromJson(json['created_at'] as int),
|
||||
updatedAt: dateFromJson(json['updated_at'] as int),
|
||||
hide: json['hide'] == null ? false : boolFromJson(json['hide'] as int),
|
||||
@@ -18,6 +19,7 @@ Budget _$BudgetFromJson(Map<String, dynamic> json) => Budget(
|
||||
Map<String, dynamic> _$BudgetToJson(Budget instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'family_id': instance.familyId,
|
||||
'expected_income': instance.expectedIncome,
|
||||
'name': instance.name,
|
||||
'hide': boolToJson(instance.hide),
|
||||
'created_at': dateToJson(instance.createdAt),
|
||||
|
||||
@@ -40,4 +40,18 @@ class BudgetCategory {
|
||||
_$BudgetCategoryFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$BudgetCategoryToJson(this);
|
||||
|
||||
factory BudgetCategory.copyWith(
|
||||
{required BudgetCategory category,
|
||||
required Map<String, dynamic> data}) =>
|
||||
BudgetCategory(
|
||||
id: data['id'] ?? category.id,
|
||||
budgetId: data['budget_id'] ?? category.budgetId,
|
||||
name: data['name'] ?? category.name,
|
||||
color: data['color'] ?? category.color,
|
||||
createdAt: data['created_at'] ?? category.createdAt,
|
||||
updatedAt: data['updated_at'] ?? category.updatedAt,
|
||||
amount: data['amount'] ?? category.amount,
|
||||
hide: data['hide'] ?? category.hide,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class Transaction {
|
||||
required this.type,
|
||||
required this.budgetId,
|
||||
this.budgetCategoryId,
|
||||
required this.addedByUserId,
|
||||
required this.createdByUserId,
|
||||
required this.date,
|
||||
this.memo,
|
||||
this.createdAt,
|
||||
@@ -26,7 +26,7 @@ class Transaction {
|
||||
});
|
||||
|
||||
final int? id, budgetCategoryId;
|
||||
final int budgetId, addedByUserId;
|
||||
final int budgetId, createdByUserId;
|
||||
final double amount;
|
||||
final String? memo;
|
||||
final TransactionType type;
|
||||
@@ -53,7 +53,7 @@ class Transaction {
|
||||
type: data['type'] ?? trans.type,
|
||||
budgetId: data['budget_id'] ?? trans.budgetId,
|
||||
budgetCategoryId: data['budget_category_id'] ?? trans.budgetCategoryId,
|
||||
addedByUserId: data['added_by_user_id'] ?? trans.addedByUserId,
|
||||
createdByUserId: data['created_by_user_id'] ?? trans.createdByUserId,
|
||||
date: data['date'] ?? trans.date,
|
||||
memo: data['memo'] ?? trans.memo,
|
||||
createdAt: data['created_at'] ?? trans.createdAt,
|
||||
|
||||
@@ -12,7 +12,7 @@ Transaction _$TransactionFromJson(Map<String, dynamic> json) => Transaction(
|
||||
type: $enumDecode(_$TransactionTypeEnumMap, json['type']),
|
||||
budgetId: json['budget_id'] as int,
|
||||
budgetCategoryId: json['budget_category_id'] as int?,
|
||||
addedByUserId: json['added_by_user_id'] as int,
|
||||
createdByUserId: json['created_by_user_id'] as int,
|
||||
date: dateFromJson(json['date'] as int),
|
||||
memo: json['memo'] as String?,
|
||||
createdAt: dateFromJson(json['created_at'] as int),
|
||||
@@ -25,7 +25,7 @@ Map<String, dynamic> _$TransactionToJson(Transaction instance) =>
|
||||
'id': instance.id,
|
||||
'budget_category_id': instance.budgetCategoryId,
|
||||
'budget_id': instance.budgetId,
|
||||
'added_by_user_id': instance.addedByUserId,
|
||||
'created_by_user_id': instance.createdByUserId,
|
||||
'amount': instance.amount,
|
||||
'memo': instance.memo,
|
||||
'type': _$TransactionTypeEnumMap[instance.type]!,
|
||||
|
||||
Reference in New Issue
Block a user