Add the API to delete the Links model.

This commit is contained in:
2023-07-30 20:28:22 +03:00
parent 4e43da527f
commit b2fd493d07
2 changed files with 10 additions and 0 deletions
@@ -23,4 +23,12 @@ defmodule LinkShortenerWeb.Api.V1.LinksController do
link = Links.get_one(id)
render(conn, "show.json", links: link)
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