philomena/lib/philomena_web/controllers/advert_controller.ex

17 lines
341 B
Elixir
Raw Normal View History

2019-11-29 07:26:05 +01:00
defmodule PhilomenaWeb.AdvertController do
use PhilomenaWeb, :controller
2020-05-27 23:14:22 +02:00
alias PhilomenaWeb.AdvertUpdater
2019-11-29 07:26:05 +01:00
alias Philomena.Adverts.Advert
plug :load_resource, model: Advert
def show(conn, _params) do
advert = conn.assigns.advert
2020-05-27 23:14:22 +02:00
AdvertUpdater.cast(:click, advert.id)
2019-11-29 07:26:05 +01:00
2020-05-27 23:14:22 +02:00
redirect(conn, external: advert.link)
2019-11-29 07:26:05 +01:00
end
2020-01-11 05:20:19 +01:00
end