 defmodule OntagCoreWeb.AnswerController do
   use OntagCoreWeb, :controller
   alias OntagCore.QAMS
+  alias OntagCore.Repo
 
   plug OntagCoreWeb.Authentication when action in [:create]
   action_fallback OntagCoreWeb.FallbackController

    with {:ok, answer} <- QAMS.create_answer(author, params) do
      conn
      |> put_status(:created)
      |> json(%{id: answer.id})
    end
  end

  def index(conn, _) do
    answers =
      QAMS.list_answers()
      |> Enum.map(fn answer -> %{id: answer.id} end)

    conn
    |> put_status(:ok)

      |> json(%{message: "Tag successfully deleted"})
    end
  end

  defp take(annotations) do
    Enum.map(annotations, fn a -> %{id: a.id,
                                    tag_id: a.tag_id,
                                    entry_id: a.entry_id,
                                    target: a.target} end)
  end
end
