1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.AdminAPI.Search do
13 defmacro not_empty_string(string) do
15 is_binary(unquote(string)) and unquote(string) != ""
19 @spec user(map()) :: {:ok, [User.t()], pos_integer()}
20 def user(params \\ %{}) do
21 query = User.Query.build(params) |> order_by([u], u.nickname)
24 User.Query.paginate(query, params[:page] || 1, params[:page_size] || @page_size)
26 count = Repo.aggregate(query, :count, :id)
28 results = Repo.all(paginated_query)