Working api call to backend

This commit is contained in:
Nathan Anderson
2023-07-19 02:16:13 -06:00
parent 37c644ab0d
commit eba628bb4c
26 changed files with 1094 additions and 119 deletions
+40
View File
@@ -0,0 +1,40 @@
import 'package:json_annotation/json_annotation.dart';
import '../global/utils.dart';
part 'transaction_model.g.dart';
enum TransactionType {
income,
expense,
}
@JsonSerializable()
class Transaction {
const Transaction({
this.id,
required this.amount,
required this.transactionType,
required this.budgetId,
required this.budgetCategoryId,
required this.addedByUserId,
required this.date,
this.createdAt,
});
final int? id;
final int budgetId, budgetCategoryId, addedByUserId;
final double amount;
final TransactionType transactionType;
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
final DateTime date;
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
final DateTime? createdAt;
factory Transaction.fromJson(Map<String, dynamic> json) =>
_$TransactionFromJson(json);
Map<String, dynamic> toJson() => _$TransactionToJson(this);
}