fixed patch
This commit is contained in:
@@ -317,7 +317,8 @@ public class Routes {
|
||||
}
|
||||
|
||||
@PatchMapping("/post/{id}")
|
||||
public void reactToPost(@PathVariable long id, @RequestBody Optional<Boolean> reaction) {
|
||||
public void reactToPost(@PathVariable long id, @RequestBody JodelPost post) {
|
||||
System.out.println(post.reaction);
|
||||
long userID = User.getID();
|
||||
|
||||
// DB connection and statement
|
||||
@@ -339,7 +340,7 @@ public class Routes {
|
||||
// create a new statement
|
||||
stmt = c.prepareStatement("UPDATE Reactions SET positive = (?) WHERE post = (?) AND userid = (?) RETURNING id, positive");
|
||||
|
||||
stmt.setObject(1, reaction.orElse(null));
|
||||
stmt.setObject(1, post.reaction.orElse(null));
|
||||
stmt.setObject(2, id);
|
||||
stmt.setObject(3, userID);
|
||||
|
||||
@@ -354,7 +355,7 @@ public class Routes {
|
||||
// fill statement
|
||||
stmt.setObject(1, userID);
|
||||
stmt.setObject(2, id);
|
||||
stmt.setObject(3, reaction.orElse(null));
|
||||
stmt.setObject(3, post.reaction.orElse(null));
|
||||
|
||||
// execute statement
|
||||
stmt.execute();
|
||||
|
||||
Reference in New Issue
Block a user