diff --git a/lib/runosaari/registration/performer.ex b/lib/runosaari/registration/performer.ex
index fc39459..9cb9601 100644
--- a/lib/runosaari/registration/performer.ex
+++ b/lib/runosaari/registration/performer.ex
@@ -8,7 +8,6 @@ defmodule Runosaari.Registration.Performer do
field :fname, :string
field :lname, :string
field :notes, :string
- field :performerId, :integer
field :tel, :string
timestamps()
@@ -17,9 +16,8 @@ defmodule Runosaari.Registration.Performer do
@doc false
def changeset(performer, attrs) do
performer
- |> cast(attrs, [:performerId, :fname, :lname, :email, :tel, :confirmed, :notes])
- |> validate_required([:performerId, :fname, :lname, :email, :tel, :confirmed, :notes])
- |> unique_constraint(:performerId)
+ |> cast(attrs, [:fname, :lname, :email, :tel, :confirmed, :notes])
+ |> validate_required([:fname, :lname, :email, :tel, :confirmed, :notes])
|> unique_constraint(:email)
end
end
diff --git a/lib/runosaari_web/templates/performer/form.html.eex b/lib/runosaari_web/templates/performer/form.html.eex
index a2ef60b..b82342c 100644
--- a/lib/runosaari_web/templates/performer/form.html.eex
+++ b/lib/runosaari_web/templates/performer/form.html.eex
@@ -5,10 +5,6 @@
<% end %>
- <%= label f, :performerId %>
- <%= number_input f, :performerId %>
- <%= error_tag f, :performerId %>
-
<%= label f, :fname %>
<%= text_input f, :fname %>
<%= error_tag f, :fname %>
diff --git a/lib/runosaari_web/templates/performer/index.html.eex b/lib/runosaari_web/templates/performer/index.html.eex
index 48fe984..2a29a64 100644
--- a/lib/runosaari_web/templates/performer/index.html.eex
+++ b/lib/runosaari_web/templates/performer/index.html.eex
@@ -3,7 +3,6 @@
- | Performerid |
Fname |
Lname |
Email |
@@ -17,7 +16,6 @@
<%= for performer <- @performers do %>
- | <%= performer.performerId %> |
<%= performer.fname %> |
<%= performer.lname %> |
<%= performer.email %> |
diff --git a/lib/runosaari_web/templates/performer/show.html.eex b/lib/runosaari_web/templates/performer/show.html.eex
index 67dd071..f8e601d 100644
--- a/lib/runosaari_web/templates/performer/show.html.eex
+++ b/lib/runosaari_web/templates/performer/show.html.eex
@@ -2,11 +2,6 @@
- -
- Performerid:
- <%= @performer.performerId %>
-
-
-
Fname:
<%= @performer.fname %>
diff --git a/priv/repo/migrations/20210327142456_create_performers.exs b/priv/repo/migrations/20210327142456_create_performers.exs
index 6331b15..feace8d 100644
--- a/priv/repo/migrations/20210327142456_create_performers.exs
+++ b/priv/repo/migrations/20210327142456_create_performers.exs
@@ -3,10 +3,9 @@ defmodule Runosaari.Repo.Migrations.CreatePerformers do
def change do
create table(:performers) do
- add :performerId, :integer
+ add :email, :string
add :fname, :string
add :lname, :string
- add :email, :string
add :tel, :string
add :confirmed, :boolean, default: false, null: false
add :notes, :string
@@ -14,7 +13,6 @@ defmodule Runosaari.Repo.Migrations.CreatePerformers do
timestamps()
end
- create unique_index(:performers, [:performerId])
create unique_index(:performers, [:email])
end
end
diff --git a/test/runosaari/registration_test.exs b/test/runosaari/registration_test.exs
index 8b3b4b8..d778454 100644
--- a/test/runosaari/registration_test.exs
+++ b/test/runosaari/registration_test.exs
@@ -6,9 +6,23 @@ defmodule Runosaari.RegistrationTest do
describe "performers" do
alias Runosaari.Registration.Performer
- @valid_attrs %{confirmed: true, email: "some email", fname: "some fname", lname: "some lname", notes: "some notes", performerId: 42, tel: "some tel"}
- @update_attrs %{confirmed: false, email: "some updated email", fname: "some updated fname", lname: "some updated lname", notes: "some updated notes", performerId: 43, tel: "some updated tel"}
- @invalid_attrs %{confirmed: nil, email: nil, fname: nil, lname: nil, notes: nil, performerId: nil, tel: nil}
+ @valid_attrs %{
+ confirmed: true,
+ email: "some email",
+ fname: "some fname",
+ lname: "some lname",
+ notes: "some notes",
+ tel: "some tel"
+ }
+ @update_attrs %{
+ confirmed: false,
+ email: "some updated email",
+ fname: "some updated fname",
+ lname: "some updated lname",
+ notes: "some updated notes",
+ tel: "some updated tel"
+ }
+ @invalid_attrs %{confirmed: nil, email: nil, fname: nil, lname: nil, notes: nil, tel: nil}
def performer_fixture(attrs \\ %{}) do
{:ok, performer} =
@@ -36,7 +50,6 @@ defmodule Runosaari.RegistrationTest do
assert performer.fname == "some fname"
assert performer.lname == "some lname"
assert performer.notes == "some notes"
- assert performer.performerId == 42
assert performer.tel == "some tel"
end
@@ -46,19 +59,24 @@ defmodule Runosaari.RegistrationTest do
test "update_performer/2 with valid data updates the performer" do
performer = performer_fixture()
- assert {:ok, %Performer{} = performer} = Registration.update_performer(performer, @update_attrs)
+
+ assert {:ok, %Performer{} = performer} =
+ Registration.update_performer(performer, @update_attrs)
+
assert performer.confirmed == false
assert performer.email == "some updated email"
assert performer.fname == "some updated fname"
assert performer.lname == "some updated lname"
assert performer.notes == "some updated notes"
- assert performer.performerId == 43
assert performer.tel == "some updated tel"
end
test "update_performer/2 with invalid data returns error changeset" do
performer = performer_fixture()
- assert {:error, %Ecto.Changeset{}} = Registration.update_performer(performer, @invalid_attrs)
+
+ assert {:error, %Ecto.Changeset{}} =
+ Registration.update_performer(performer, @invalid_attrs)
+
assert performer == Registration.get_performer!(performer.id)
end
diff --git a/test/runosaari_web/controllers/performer_controller_test.exs b/test/runosaari_web/controllers/performer_controller_test.exs
index ad40d5a..650e0b7 100644
--- a/test/runosaari_web/controllers/performer_controller_test.exs
+++ b/test/runosaari_web/controllers/performer_controller_test.exs
@@ -3,9 +3,23 @@ defmodule RunosaariWeb.PerformerControllerTest do
alias Runosaari.Registration
- @create_attrs %{confirmed: true, email: "some email", fname: "some fname", lname: "some lname", notes: "some notes", performerId: 42, tel: "some tel"}
- @update_attrs %{confirmed: false, email: "some updated email", fname: "some updated fname", lname: "some updated lname", notes: "some updated notes", performerId: 43, tel: "some updated tel"}
- @invalid_attrs %{confirmed: nil, email: nil, fname: nil, lname: nil, notes: nil, performerId: nil, tel: nil}
+ @create_attrs %{
+ confirmed: true,
+ email: "some email",
+ fname: "some fname",
+ lname: "some lname",
+ notes: "some notes",
+ tel: "some tel"
+ }
+ @update_attrs %{
+ confirmed: false,
+ email: "some updated email",
+ fname: "some updated fname",
+ lname: "some updated lname",
+ notes: "some updated notes",
+ tel: "some updated tel"
+ }
+ @invalid_attrs %{confirmed: nil, email: nil, fname: nil, lname: nil, notes: nil, tel: nil}
def fixture(:performer) do
{:ok, performer} = Registration.create_performer(@create_attrs)
@@ -75,6 +89,7 @@ defmodule RunosaariWeb.PerformerControllerTest do
test "deletes chosen performer", %{conn: conn, performer: performer} do
conn = delete(conn, Routes.performer_path(conn, :delete, performer))
assert redirected_to(conn) == Routes.performer_path(conn, :index)
+
assert_error_sent 404, fn ->
get(conn, Routes.performer_path(conn, :show, performer))
end