working on usability
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user