From 02b7fdec310355c13a3ca1c31d11e1468c8a4840 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 16 Dec 2019 18:14:22 -0500 Subject: [PATCH] convert rows to json --- .../controllers/api/json/search/reverse_controller.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/philomena_web/controllers/api/json/search/reverse_controller.ex b/lib/philomena_web/controllers/api/json/search/reverse_controller.ex index eb3be941..818ac7ae 100644 --- a/lib/philomena_web/controllers/api/json/search/reverse_controller.ex +++ b/lib/philomena_web/controllers/api/json/search/reverse_controller.ex @@ -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 \ No newline at end of file +end