86 lines
2.9 KiB
D
86 lines
2.9 KiB
D
module profile.data;
|
|
|
|
import handy_http_primitives : Optional;
|
|
|
|
import profile.model;
|
|
|
|
/// Repository for interacting with the set of profiles belonging to a user.
|
|
interface ProfileRepository {
|
|
Optional!Profile findByName(string name);
|
|
Profile createProfile(string name);
|
|
Profile[] findAll();
|
|
void deleteByName(string name);
|
|
ProfileDataSource getDataSource(in Profile profile);
|
|
}
|
|
|
|
/// Repository for accessing the properties of a profile.
|
|
interface PropertiesRepository {
|
|
Optional!string findProperty(string propertyName);
|
|
void setProperty(string name, string value);
|
|
void deleteProperty(string name);
|
|
ProfileProperty[] findAll();
|
|
}
|
|
|
|
/**
|
|
* A data source for all data contained within a profile. This serves as the
|
|
* gateway for all data access operations for a profile.
|
|
*/
|
|
interface ProfileDataSource {
|
|
import account.data;
|
|
import transaction.data;
|
|
import attachment.data;
|
|
|
|
PropertiesRepository getPropertiesRepository();
|
|
AttachmentRepository getAttachmentRepository();
|
|
|
|
AccountRepository getAccountRepository();
|
|
AccountJournalEntryRepository getAccountJournalEntryRepository();
|
|
AccountValueRecordRepository getAccountValueRecordRepository();
|
|
|
|
TransactionVendorRepository getTransactionVendorRepository();
|
|
TransactionCategoryRepository getTransactionCategoryRepository();
|
|
TransactionTagRepository getTransactionTagRepository();
|
|
TransactionRepository getTransactionRepository();
|
|
|
|
void doTransaction(void delegate () dg);
|
|
}
|
|
|
|
version(unittest) {
|
|
class TestProfileDataSourceStub : ProfileDataSource {
|
|
import account.data;
|
|
import transaction.data;
|
|
import attachment.data;
|
|
|
|
PropertiesRepository getPropertiesRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
AttachmentRepository getAttachmentRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
AccountRepository getAccountRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
AccountJournalEntryRepository getAccountJournalEntryRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
AccountValueRecordRepository getAccountValueRecordRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
TransactionVendorRepository getTransactionVendorRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
TransactionCategoryRepository getTransactionCategoryRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
TransactionTagRepository getTransactionTagRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
TransactionRepository getTransactionRepository() {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
void doTransaction(void delegate () dg) {
|
|
throw new Exception("Not implemented");
|
|
}
|
|
}
|
|
}
|