implemented transaction propagation via event bus
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -53,6 +53,10 @@ public class ModuleRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
public static AccountingService accountingService() {
|
||||
return singleton.accountingService;
|
||||
}
|
||||
|
||||
public static BookmarkService bookmarkService(){
|
||||
return singleton.bookmarkService;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.api;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import de.srsoftware.umbrella.core.constants.Field;
|
||||
import de.srsoftware.umbrella.core.model.Account;
|
||||
import de.srsoftware.umbrella.core.model.Transaction;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static de.srsoftware.umbrella.core.Util.mapValues;
|
||||
|
||||
public interface AccountingService {
|
||||
public record AccountData(Account account, List<Transaction> transactions, HashMap<Long, UmbrellaUser> userMap) implements Mappable {
|
||||
public static AccountData of(Account account, List<Transaction> transactions, HashMap<Long, UmbrellaUser> userMap) {
|
||||
return new AccountData(account, transactions, userMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
return Map.of(
|
||||
Field.ACCOUNT,account.toMap(),
|
||||
Field.TRANSACTIONS,transactions.stream().map(Transaction::toMap).toList(),
|
||||
Field.USER_LIST,mapValues(userMap)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AccountData loadAccount(long accountId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user