added tests, preparing submission confirmation

This commit is contained in:
2022-04-17 19:52:52 +02:00
parent 6d73018247
commit e2bba174ee
9 changed files with 335 additions and 157 deletions

View File

@@ -53,7 +53,12 @@ public class Rest extends HttpServlet {
json.put(USER,user.safeMap());
switch (path) {
case USER_LIST:
json.put("users", (user.is(ADMIN) ? User.list() : List.of(user)).stream().map(User::safeMap).toList());
try {
json.put("users", (user.is(ADMIN) ? User.loadAll() : List.of(user)).stream().map(User::safeMap).toList());
} catch (SQLException e) {
LOG.debug("Failed to load user list:",e);
json.put(ERROR,"failed to load user list");
}
break;
case LIST_LIST:
json.put("lists", MailingList.listsOf(user).stream().map(MailingList::safeMap).toList());