Merge branch 'main' into lang_de

This commit is contained in:
2024-03-15 13:34:33 +01:00
9 changed files with 89 additions and 45 deletions

View File

@@ -96,7 +96,7 @@ public class Post {
return new File(filename);
}
public static ArrayList<Post> find(MailingList list, String month, List<String> allowedSenders) throws SQLException {
public static ArrayList<Post> find(MailingList list, String month, List<String> allowedSenders) throws SQLException {
var query = Database.open()
.select(TABLE_NAME,"*","strftime('%Y-%m',date/1000,'unixepoch') as month")
.where(LIST,list.email())
@@ -140,6 +140,10 @@ public class Post {
return id;
}
public MailingList list() {
return list;
}
public static Post load(String id) throws SQLException {
var rs = Database.open().select(TABLE_NAME).where(ID,id).compile().exec();
try {
@@ -160,6 +164,11 @@ public class Post {
FILE,filename);
}
public void remove() throws SQLException {
Database.open().deleteFrom(TABLE_NAME).where(ID,id).compile().run();
file().delete();
}
public Map<String,Object> safeMap() {
return Map.of(ID,id,
LIST,list.name(),
@@ -188,5 +197,4 @@ public class Post {
public long timestamp(){
return timestamp;
}
}