public function view()
 {
     $id = $_GET["id"];
     $threadModel = new Thread();
     $thread = $threadModel->getById($id);
     $answerModel = new Answer();
     $answers = $answerModel->getByThreadId($id);
     $thread["answer"] = count($answers);
     $this->render("thread/view", ["thread" => $thread, "answers" => $answers]);
 }
 public function downvote()
 {
     if (isset($_POST["id"])) {
         $id = $_POST["id"];
         $answerModel = new Answer();
         $answerModel->downvote($id);
         $this->jsonResponse(["status" => "OK"]);
     } else {
         $this->jsonResponse(["error" => "Missing parameter ID"], 400);
     }
 }