Add the API to update the Link model.

This commit is contained in:
2023-08-01 18:02:14 +03:00
parent 62e855e1b6
commit e6e344745b
2 changed files with 9 additions and 0 deletions
@@ -24,6 +24,13 @@ defmodule LinkShortenerWeb.Api.V1.LinkController do
link = Links.get_one(id)
render(conn, "show.json", link: link)
end
def update(conn, %{"id" => id, "link" => link_params}) do
link = Links.get_one(id)
with {:ok, %Link{} = link} <- Links.update_one(link, link_params) do
render(conn, "show.json", link: link)
end
end
def delete(conn, %{"id" => id}) do