mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
fix error on gallery search
This commit is contained in:
parent
6ef394a024
commit
843398cead
1 changed files with 6 additions and 2 deletions
|
@ -2,8 +2,12 @@ defmodule Philomena.Images.Query do
|
||||||
alias Philomena.Search.Parser
|
alias Philomena.Search.Parser
|
||||||
alias Philomena.Repo
|
alias Philomena.Repo
|
||||||
|
|
||||||
defp gallery_id_transform(_ctx, value),
|
defp gallery_id_transform(_ctx, value) do
|
||||||
do: {:ok, %{nested: %{path: :galleries, query: %{term: %{"galleries.id" => value}}}}}
|
case Integer.parse(value) do
|
||||||
|
{value, ""} when value >= 0 -> {:ok, %{nested: %{path: :galleries, query: %{term: %{"galleries.id" => value}}}}}
|
||||||
|
_error -> {:error, "Invalid gallery `#{value}'."}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp user_my_transform(%{user: %{id: id}}, "faves"),
|
defp user_my_transform(%{user: %{id: id}}, "faves"),
|
||||||
do: {:ok, %{term: %{favourited_by_user_ids: id}}}
|
do: {:ok, %{term: %{favourited_by_user_ids: id}}}
|
||||||
|
|
Loading…
Reference in a new issue