Add the API to delete the Links model.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user