Add the API to delete the Links model.

main 0.4.2
KKlochko 2 years ago
parent 4e43da527f
commit b2fd493d07

@ -21,4 +21,6 @@
Added the API to show the Links model or models. Added the API to show the Links model or models.
** 0.4.1 <2023-07-29 Sat> ** 0.4.1 <2023-07-29 Sat>
Add the API to create the Links model. Add the API to create the Links model.
** 0.4.2 <2023-07-30 Sun>
Add the API to delete the Links model.

@ -23,4 +23,12 @@ defmodule LinkShortenerWeb.Api.V1.LinksController do
link = Links.get_one(id) link = Links.get_one(id)
render(conn, "show.json", links: link) render(conn, "show.json", links: link)
end end
def delete(conn, %{"id" => id}) do
link = Links.get_one(id)
with {:ok, %Link{}} <- Links.delete_one(link) do
send_resp(conn, :no_content, "")
end
end
end end

Loading…
Cancel
Save