Birth dates: Add tests

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-01-18 19:29:21 +01:00
commit dfb2808535
9 changed files with 210 additions and 9 deletions

View file

@ -234,12 +234,14 @@ defmodule Pleroma.User.Query do
defp compose_query({:birth_day, day}, query) do
query
|> where([u], u.hide_birth_date == false)
|> 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], u.hide_birth_date == false)
|> where([u], not is_nil(u.birth_date))
|> where([u], fragment("date_part('month', ?)", u.birth_date) == ^month)
end