Non-admin users can now submit beacons but they are held in an unapproved state until an admin approves them. Only approved beacons appear in the public list; pending submissions are shown in a separate admin-only section on /beacons with Approve and Delete actions. The show page surfaces a pending badge and an admin-only Approve button when viewing an unapproved beacon. Also formats EIRP (mW) on the index page without scientific notation.
12 lines
328 B
Elixir
12 lines
328 B
Elixir
defmodule Microwaveprop.Repo.Migrations.AddApprovedToBeacons do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
alter table(:beacons) do
|
|
add :approved, :boolean, null: false, default: false
|
|
end
|
|
|
|
# Existing beacons were admin-created, so mark them approved.
|
|
execute "UPDATE beacons SET approved = true", ""
|
|
end
|
|
end
|