finnow/finnow-api/source/account/data.d

35 lines
1014 B
D

module account.data;
import handy_httpd.components.optional;
import account.model;
import util.money;
import history.model;
import std.datetime : SysTime;
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);
}
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);
}