Rename the controller and the view names to "Link".

main
KKlochko 2 years ago
parent b2fd493d07
commit 6799e5b00b

@ -23,4 +23,6 @@
Add the API to create the Links model.
** 0.4.2 <2023-07-30 Sun>
Add the API to delete the Links model.
** 0.4.3 <2023-07-31 Mon>
Rename the controller and the view names to "Link".

@ -1,4 +1,4 @@
defmodule LinkShortenerWeb.Api.V1.LinksController do
defmodule LinkShortenerWeb.Api.V1.LinkController do
use LinkShortenerWeb, :controller
alias LinkShortener.Links

@ -26,7 +26,7 @@ defmodule LinkShortenerWeb.Router do
pipe_through :api
scope "/v1", Api.V1, as: :v1 do
resources "/links", LinksController
resources "/links", LinkController
end
end

@ -1,13 +1,13 @@
defmodule LinkShortenerWeb.Api.V1.LinksView do
defmodule LinkShortenerWeb.Api.V1.LinkView do
use LinkShortenerWeb, :view
alias LinkShortenerWeb.Api.V1.LinksView
alias LinkShortenerWeb.Api.V1.LinkView
def render("index.json", %{links: links}) do
%{data: render_many(links, LinksView, "link.json")}
%{data: render_many(links, LinkView, "link.json")}
end
def render("show.json", %{links: link}) do
%{data: render_one(link, LinksView, "link.json")}
%{data: render_one(link, LinkView, "link.json")}
end
def render("link.json", %{links: link}) do
Loading…
Cancel
Save