grouping mail archive by year-month
This commit is contained in:
@@ -14,7 +14,6 @@ import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Member;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -62,17 +61,22 @@ public class Rest extends HttpServlet {
|
||||
return Map.of(SUCCESS,"Updated user permissions");
|
||||
}
|
||||
|
||||
private List<? extends Object> archive(HttpServletRequest req) {
|
||||
private Map<String, Object> archive(HttpServletRequest req) {
|
||||
var list = Util.getMailingList(req);
|
||||
if (list != null){
|
||||
try {
|
||||
return Post.find(list).stream().map(Post::safeMap).toList();
|
||||
var month = req.getParameter(MONTH);
|
||||
if (month == null || month.isBlank()) {
|
||||
return Map.of(LIST,list.email(),"summary",Post.summarize(list));
|
||||
} else {
|
||||
return Map.of(LIST,list.email(),"posts",Post.find(list,month).stream().map(Post::safeMap).toList());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
LOG.debug("list: {}",list.email());
|
||||
return List.of();
|
||||
return Map.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user