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()
end
def edit_one(%Link{} = link) do
def edit_one(%Link{} = link, attrs \\ %{}) do
link
|> Link.changeset(%{})
|> Link.changeset(attrs)
end
def update_one(%Link{} = link, changes) do

Loading…
Cancel
Save