- Add hardware/config fields migration to beacon_monitors table - Update BeaconMonitor schema with provision/config changesets - Add context functions: create_hardware, update_config, list_all_monitors - Remove user-facing monitor creation (browser POST + API POST) - Update settings page: show assigned monitors table with hardware info - Update profile page: show assigned monitors, remove register links - Fix all tests to match new API
18 lines
542 B
Elixir
18 lines
542 B
Elixir
defmodule MicrowavepropWeb.BeaconMonitorController do
|
|
use MicrowavepropWeb, :controller
|
|
|
|
alias Microwaveprop.BeaconMonitors
|
|
|
|
@spec delete(Plug.Conn.t(), map()) :: Plug.Conn.t()
|
|
def delete(conn, %{"id" => id}) do
|
|
user = conn.assigns.current_scope.user
|
|
|
|
conn =
|
|
case BeaconMonitors.delete_monitor(user, id) do
|
|
{:ok, _monitor} -> put_flash(conn, :info, "Monitor deleted.")
|
|
{:error, :not_found} -> put_flash(conn, :error, "Monitor not found.")
|
|
end
|
|
|
|
redirect(conn, to: ~p"/users/settings")
|
|
end
|
|
end
|