 defmodule AtomTweaksWeb.TweakController do
   use AtomTweaksWeb, :controller
 
-  alias AtomTweaks.Accounts.User
   alias AtomTweaks.Tweaks
   alias AtomTweaks.Tweaks.Tweak
   alias AtomTweaksWeb.NotLoggedInError


  **Not implemented.**
  """
  @spec delete(Plug.Conn.t(), Map.t(), current_user) :: Plug.Conn.t()
  def delete(conn, _params, _current_user) do
    conn
  end

  @doc """
  Displays the edit tweak form.
  """
  @spec edit(Plug.Conn.t(), Map.t(), current_user) :: Plug.Conn.t()
  def edit(conn, params, current_user)

  def edit(conn, _, :guest), do: raise(NotLoggedInError, conn: conn)

  def edit(conn, %{"id" => id}, current_user) do
    tweak =
      Tweak
      |> Repo.get(id)

  @doc """
  Updates a tweak with the given parameters.
  """
  @spec update(Plug.Conn.t(), Map.t()) :: Plug.Conn.t()
  def update(conn, params)

  def update(conn, %{"user_id" => name, "id" => id, "tweak" => tweak_params}) do
    tweak = Repo.get(Tweak, id)
    changeset = Tweak.changeset(tweak, tweak_params)

