2021-06-28 16:32:25 +02:00
|
|
|
defmodule PokemonCoutureWeb.ClothesController do
|
|
|
|
use PokemonCoutureWeb, :controller
|
|
|
|
|
|
|
|
alias PokemonCouture.Shops
|
|
|
|
|
|
|
|
def index(conn, _params) do
|
2021-10-07 17:26:45 +02:00
|
|
|
clothes_map = Shops.create_shop_map()
|
|
|
|
clothes_map = for {shop, map} <- clothes_map
|
|
|
|
do {shop, Enum.reduce(map, %{}, &Shops.inner_map_creator/2)}
|
|
|
|
end
|
|
|
|
render(conn, "index.html", clothes_map: clothes_map)
|
2021-06-28 16:32:25 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def show(conn, %{"id" => id}) do
|
|
|
|
clothes = Shops.get_clothes!(id)
|
|
|
|
render(conn, "show.html", clothes: clothes)
|
|
|
|
end
|
|
|
|
end
|