Update the edit function in Links to support existing links.

dev
KKlochko 8 months ago
parent 6300a1a8b7
commit d2f8543fdd

@ -49,9 +49,9 @@ defmodule LinkShortener.Links do
|> Repo.all() |> Repo.all()
end end
def edit_one(%Link{} = link) do def edit_one(%Link{} = link, attrs \\ %{}) do
link link
|> Link.changeset(%{}) |> Link.changeset(attrs)
end end
def update_one(%Link{} = link, changes) do def update_one(%Link{} = link, changes) do

Loading…
Cancel
Save