fixed post and added delete

This commit is contained in:
2024-06-04 10:04:47 +02:00
parent 9070d1452b
commit 74d421514d
3 changed files with 87 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import java.util.Vector;
import java.sql.*;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public class JodelPost {
@@ -30,6 +31,8 @@ public class JodelPost {
public Optional<Boolean> reaction;
// all other reactions
public Reactions reactions;
// Parent id
public Optional<Long> parent = Optional.empty();
// anonymize function to recursively anonymize the posts
public void anonymize(Optional<Vector<Long>> idCache) {
@@ -95,12 +98,19 @@ public class JodelPost {
@JsonCreator
public JodelPost(@JsonProperty("title") String title,
@JsonProperty("content") String content,
@JsonProperty("postdate") Timestamp date,
@JsonProperty("location") Location location) {
@JsonProperty("date") Timestamp date,
@JsonProperty("location") Location location,
@JsonProperty("parent") Optional<Long> parent) {
this.authorID = 10000L; // TODO: getter from Keycloak
this.title = title;
this.content = content;
this.date = date;
this.location = location;
this.location = location;
this.parent = parent;
}
@JsonIgnore
public long getAuthorID() {
return authorID;
}
}