2020-01-26 19:34:25 +00:00
|
|
|
defmodule Mobilizon.GraphQL.Resolvers.Search do
|
2019-02-21 17:11:49 +00:00
|
|
|
@moduledoc """
|
|
|
|
Handles the event-related GraphQL calls
|
|
|
|
"""
|
2020-01-26 20:11:16 +00:00
|
|
|
|
|
|
|
alias Mobilizon.GraphQL.API.Search
|
2019-02-21 17:11:49 +00:00
|
|
|
|
|
|
|
@doc """
|
2019-04-12 13:04:32 +00:00
|
|
|
Search persons
|
2019-02-21 17:11:49 +00:00
|
|
|
"""
|
2020-08-05 14:44:08 +00:00
|
|
|
def search_persons(_parent, %{page: page, limit: limit} = args, _resolution) do
|
2021-05-02 17:27:34 +00:00
|
|
|
Search.search_actors(Map.put(args, :minimum_visibility, :private), page, limit, :Person)
|
2019-04-12 13:04:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Search groups
|
|
|
|
"""
|
2020-08-05 14:44:08 +00:00
|
|
|
def search_groups(_parent, %{page: page, limit: limit} = args, _resolution) do
|
|
|
|
Search.search_actors(args, page, limit, :Group)
|
2019-04-12 13:04:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Search events
|
|
|
|
"""
|
2020-07-31 15:52:26 +00:00
|
|
|
def search_events(_parent, %{page: page, limit: limit} = args, _resolution) do
|
|
|
|
Search.search_events(args, page, limit)
|
2019-02-21 17:11:49 +00:00
|
|
|
end
|
2020-11-06 10:34:32 +00:00
|
|
|
|
|
|
|
def interact(_parent, %{uri: uri}, _resolution) do
|
|
|
|
Search.interact(uri)
|
|
|
|
end
|
2019-02-21 17:11:49 +00:00
|
|
|
end
|