Add embedded schema for Artikel

This commit is contained in:
Thelonius Kort
2023-02-28 23:38:56 +01:00
parent ed98f4cbc4
commit 02e6340c0a
6 changed files with 114 additions and 7 deletions

View File

@ -1,15 +1,15 @@
defmodule OutlookWeb.ArtikelController do
use OutlookWeb, :controller
alias Outlook.Artikel
alias Outlook.Public
def index(conn, _params) do
artikel = Artikel.list_artikel()
artikel = Public.list_artikel()
render(conn, :index, artikel: artikel, page_title: "Artikel")
end
def show(conn, %{"tid" => tid} = params) do
case Artikel.get_artikel_by_tid(tid) do
case Public.get_artikel_by_tid(tid) do
{:ok, artikel} -> render(conn, :show, artikel: artikel, page_title: artikel.title)
{:error, message} -> conn
|> put_status(404)