This commit is contained in:
zack 2024-10-22 16:51:56 -04:00
parent e2967f68b2
commit ef2a6c41b4
No known key found for this signature in database
GPG key ID: 5F873416BCF59F35
39 changed files with 2349 additions and 30 deletions

View file

@ -0,0 +1,24 @@
defmodule ZoeyscomputerWeb.ImageJSON do
alias Zoeyscomputer.Images.Image
@doc """
Renders a list of images.
"""
def index(%{images: images}) do
%{data: for(image <- images, do: data(image))}
end
@doc """
Renders a single image.
"""
def show(%{image: image}) do
%{data: data(image)}
end
defp data(%Image{} = image) do
%{
id: image.id,
file: image.file
}
end
end