This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.8 — Accounts, Transactions & Api Codes (#18)
* Implemented Account model * Implemented Account Routes & fixed Session#delete * Implemented error codes * Bumped version & updated CHANGELOG.md * Implemented `Transaction`s * Updated CHANGELOG.md * dart fix * Added missing .toUtc() * Added some more logging * Load accounts on startup * Added `Account#retrieveTransactions` * Added `Restrr#getCurrencies` * Updated CHANGELOG.md * Implemented `TransactionType` * Implemented `Account#getCurrency` & `Account#retrieveCurrency` * Implemented `Transaction#getSourceAccount`, `Transaction#getDestinationAccount`, `Transaction#retrieveSourceAccount` & `Transaction#retrieveDestinationAccount` * Fixed `Account#update` (for now) * Fixed `Restrr#createTransaction` (for now) * Added missing toUtc() * Correctly use _id suffix for Ids * Implemented per-Entity Ids (#19) * Implemented per-Entity Ids * Cleaned up generics * Id => EntityId, IdPrimitive => Id * Fixed exposed id-parameters * EntityId#id => EntityId#value + added toString, == & hashCode overrides * Fixed entity building * Made ErrorResponse#reference dynamic * Fixed missing EntityId#value calls & added UserId to CustomCurrency * Added Transaction#name * Added RequestUtils#deleteSingle & fixed cache entity deletion * Implemented previous cleanup on Account and User * Updated CHANGELOG.md * dart format * Fixed & extended tests * Fixed update methods * Fixed Transaction#update * Added try-catch for preflight cache requests * fixed comment
- Loading branch information
1 parent
a56d582
commit 4289ab8
Showing
31 changed files
with
843 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import '../../../restrr.dart'; | ||
|
||
abstract class AccountId extends EntityId<Account> {} | ||
|
||
abstract class Account extends RestrrEntity<Account, AccountId> { | ||
@override | ||
AccountId get id; | ||
|
||
String get name; | ||
String? get description; | ||
String? get iban; | ||
int get balance; | ||
int get originalBalance; | ||
CurrencyId get currencyId; | ||
DateTime get createdAt; | ||
|
||
Future<bool> delete(); | ||
|
||
Future<Account> update({String? name, String? description, String? iban, int? originalBalance, Id? currencyId}); | ||
|
||
Future<Paginated<Transaction>> retrieveAllTransactions({int page = 1, int limit = 25, bool forceRetrieve = false}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:restrr/restrr.dart'; | ||
|
||
abstract class TransactionId extends EntityId<Transaction> {} | ||
|
||
abstract class Transaction extends RestrrEntity<Transaction, TransactionId> { | ||
@override | ||
TransactionId get id; | ||
|
||
AccountId? get sourceId; | ||
AccountId? get destinationId; | ||
int get amount; | ||
CurrencyId get currencyId; | ||
String get name; | ||
String? get description; | ||
EntityId? get budgetId; | ||
DateTime get createdAt; | ||
DateTime get executedAt; | ||
|
||
TransactionType get type; | ||
|
||
Future<bool> delete(); | ||
|
||
Future<Transaction> update({ | ||
Id? sourceId, | ||
Id? destinationId, | ||
int? amount, | ||
Id? currencyId, | ||
String? name, | ||
String? description, | ||
Id? budgetId, | ||
DateTime? executedAt, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enum TransactionType { deposit, withdrawal, transfer } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.