This commit is contained in:
Mirai Kumiko 2025-07-04 10:25:40 +02:00
parent b35e18cd20
commit 82f55f7afe
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
80 changed files with 6687 additions and 5 deletions

View file

@ -0,0 +1,32 @@
defmodule NullaWeb.NoteJSON do
alias Nulla.Notes.Note
@doc """
Renders a list of notes.
"""
def index(%{notes: notes}) do
%{data: for(note <- notes, do: data(note))}
end
@doc """
Renders a single note.
"""
def show(%{note: note}) do
%{data: data(note)}
end
defp data(%Note{} = note) do
%{
id: note.id,
inReplyTo: note.inReplyTo,
published: note.published,
url: note.url,
visibility: note.visibility,
to: note.to,
cc: note.cc,
sensitive: note.sensitive,
content: note.content,
language: note.language
}
end
end