diff options
Diffstat (limited to 'lib/pleroma/user/query.ex')
-rw-r--r-- | lib/pleroma/user/query.ex | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index bf78cb32d..9e594013a 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -59,7 +59,9 @@ defmodule Pleroma.User.Query do order_by: term(), select: term(), limit: pos_integer(), - actor_types: [String.t()] + actor_types: [String.t()], + birth_day: pos_integer(), + birth_month: pos_integer() } | map() @@ -230,6 +232,18 @@ defmodule Pleroma.User.Query do |> where([u], not like(u.nickname, "internal.%")) end + defp compose_query({:birth_day, day}, query) do + query + |> where([u], not is_nil(u.birth_date)) + |> where([u], fragment("date_part('day', ?)", u.birth_date) == ^day) + end + + defp compose_query({:birth_month, month}, query) do + query + |> where([u], not is_nil(u.birth_date)) + |> where([u], fragment("date_part('month', ?)", u.birth_date) == ^month) + end + defp compose_query(_unsupported_param, query), do: query defp location_query(query, local) do |