Compare commits

...
1 Commits
Author SHA1 Message Date
KKlochko b2fd493d07 Add the API to delete the Links model. 2023-07-30 20:28:22 +03:00
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -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