This commit is contained in:
Mirai Kumiko 2025-07-06 14:46:08 +02:00
parent f90a7133bc
commit 00ecbadeca
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
29 changed files with 871 additions and 12 deletions

View file

@ -0,0 +1,23 @@
defmodule NullaWeb.Api.AnnounceJSON do
alias Nulla.Announces.Announce
@doc """
Renders a list of announces.
"""
def index(%{announces: announces}) do
%{data: for(announce <- announces, do: data(announce))}
end
@doc """
Renders a single announce.
"""
def show(%{announce: announce}) do
%{data: data(announce)}
end
defp data(%Announce{} = announce) do
%{
id: announce.id
}
end
end