freactoring to get company list work in efficient way

This commit is contained in:
2025-07-18 23:23:14 +02:00
parent 722f12912d
commit a06217517b
22 changed files with 203 additions and 76 deletions

View File

@@ -137,7 +137,6 @@ public class DocumentApi extends BaseHandler {
if (user.isEmpty()) return unauthorized(ex);
var head = path.pop();
return switch (head){
case COMPANIES -> getCompanies(ex,user.get(),token.orElse(null));
case CONTACTS -> getContacts(ex,user.get(),token.orElse(null));
case PATH_TYPES -> getDocTypes(ex);
case STATES -> getDocStates(ex);
@@ -232,10 +231,6 @@ public class DocumentApi extends BaseHandler {
return ok(ex);
}
private boolean getCompanies(HttpExchange ex, UmbrellaUser user, Token token) throws IOException, UmbrellaException {
return sendContent(ex,companies.listCompaniesOf(user).stream().map(Company::toMap));
}
private boolean getContacts(HttpExchange ex, UmbrellaUser user, Token token) throws IOException, UmbrellaException {
return sendContent(ex,getLegacyContacts(ex,user,token));
}