working on usability

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-04-03 01:22:26 +02:00
parent a933ced8d8
commit 3d840b9f8a
6 changed files with 57 additions and 23 deletions

View File

@@ -13,10 +13,12 @@ import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
import de.srsoftware.umbrella.core.model.*;
import org.json.JSONObject;
import static de.srsoftware.umbrella.core.constants.Path.SOURCES;
import static de.srsoftware.umbrella.core.constants.Path.DESTINATIONS;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@@ -72,6 +74,8 @@ public class AccountingModule extends BaseHandler implements AccountingService {
var head = path.pop();
return switch (head) {
case null -> postEntry(user.get(),ex);
case SOURCES -> postSearchSources(user.get(),ex);
case DESTINATIONS -> postSearchDestinations(user.get(),ex);
default -> super.doPost(path,ex);
};
} catch (UmbrellaException e){
@@ -170,4 +174,18 @@ public class AccountingModule extends BaseHandler implements AccountingService {
return sendContent(ex,newAccount != null ? newAccount : transaction);
}
public boolean postSearchDestinations(UmbrellaUser user, HttpExchange ex) throws IOException {
var key = body(ex);
var users = userService().search(key);
// TODO: search known transactions for possible destinations
return sendContent(ex,mapValues(users));
}
public boolean postSearchSources(UmbrellaUser user, HttpExchange ex) throws IOException {
var key = body(ex);
var users = userService().search(key);
// TODO: search known transactions for possible sources
return sendContent(ex,mapValues(users));
}
}