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

47 lines
1.4 KiB
D
Raw Permalink Normal View History

module transaction.data;
import handy_httpd.components.optional;
import std.datetime;
import transaction.model;
import util.money;
interface TransactionVendorRepository {
Optional!TransactionVendor findById(ulong id);
TransactionVendor[] findAll();
bool existsByName(string name);
TransactionVendor insert(string name, string description);
void deleteById(ulong id);
TransactionVendor updateById(ulong id, string name, string description);
}
interface TransactionCategoryRepository {
Optional!TransactionCategory findById(ulong id);
TransactionCategory[] findAllByParentId(Optional!ulong parentId);
TransactionCategory insert(Optional!ulong parentId, string name, string description, string color);
void deleteById(ulong id);
TransactionCategory updateById(ulong id, string name, string description, string color);
}
interface TransactionTagRepository {
Optional!TransactionTag findById(ulong id);
Optional!TransactionTag findByName(string name);
TransactionTag[] findAll();
TransactionTag insert(string name);
void deleteById(ulong id);
}
interface TransactionRepository {
Optional!Transaction findById(ulong id);
Transaction insert(
SysTime timestamp,
SysTime addedAt,
ulong amount,
Currency currency,
string description,
Optional!ulong vendorId,
Optional!ulong categoryId
);
void deleteById(ulong id);
}