2024-08-01 17:01:50 +00:00
|
|
|
module account.data;
|
|
|
|
|
|
|
|
import handy_httpd.components.optional;
|
|
|
|
|
|
|
|
import account.model;
|
2024-09-19 19:12:23 +00:00
|
|
|
import util.money;
|
2024-08-01 17:01:50 +00:00
|
|
|
import history.model;
|
|
|
|
|
2024-09-27 15:35:08 +00:00
|
|
|
import std.datetime : SysTime;
|
|
|
|
|
2024-08-01 17:01:50 +00:00
|
|
|
interface AccountRepository {
|
|
|
|
Optional!Account findById(ulong id);
|
|
|
|
Account insert(AccountType type, string numberSuffix, string name, Currency currency, string description);
|
|
|
|
void setArchived(ulong id, bool archived);
|
|
|
|
Account update(ulong id, in Account newData);
|
|
|
|
void deleteById(ulong id);
|
|
|
|
Account[] findAll();
|
|
|
|
AccountCreditCardProperties getCreditCardProperties(ulong id);
|
|
|
|
void setCreditCardProperties(ulong id, in AccountCreditCardProperties props);
|
|
|
|
History getHistory(ulong id);
|
|
|
|
}
|
2024-09-27 15:35:08 +00:00
|
|
|
|
|
|
|
interface AccountJournalEntryRepository {
|
|
|
|
Optional!AccountJournalEntry findById(ulong id);
|
|
|
|
AccountJournalEntry insert(
|
|
|
|
SysTime timestamp,
|
|
|
|
ulong accountId,
|
|
|
|
ulong transactionId,
|
|
|
|
ulong amount,
|
|
|
|
AccountJournalEntryType type,
|
|
|
|
Currency currency
|
|
|
|
);
|
|
|
|
void deleteById(ulong id);
|
|
|
|
}
|