mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 21:47:59 +01:00
convert rows to json
This commit is contained in:
parent
d42fc44494
commit
02b7fdec31
1 changed files with 6 additions and 2 deletions
|
@ -2,12 +2,16 @@ defmodule PhilomenaWeb.Api.Json.Search.ReverseController do
|
|||
use PhilomenaWeb, :controller
|
||||
|
||||
alias PhilomenaWeb.ImageReverse
|
||||
alias PhilomenaWeb.ImageJson
|
||||
|
||||
plug :set_scraper_cache
|
||||
plug PhilomenaWeb.ScraperPlug, [params_key: "image", params_name: "image"]
|
||||
|
||||
def create(conn, %{"image" => image_params}) do
|
||||
images = ImageReverse.images(image_params)
|
||||
images =
|
||||
image_params
|
||||
|> ImageReverse.images()
|
||||
|> Enum.map(&ImageJson.as_json(conn, &1))
|
||||
|
||||
conn
|
||||
|> json(%{images: images})
|
||||
|
@ -21,4 +25,4 @@ defmodule PhilomenaWeb.Api.Json.Search.ReverseController do
|
|||
|
||||
%{conn | params: params}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue