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