Search sites by their members

This commit is contained in:
Uku Taht 2021-01-08 15:36:26 +02:00
parent c4d7b5ae05
commit e692afc20e

View File

@ -1,6 +1,13 @@
defmodule Plausible.SiteAdmin do
use Plausible.Repo
def search_fields(_schema) do
[
:domain,
members: [:name, :email]
]
end
def custom_index_query(_conn, _schema, query) do
from(r in query, preload: [:members])
end
@ -18,7 +25,7 @@ defmodule Plausible.SiteAdmin do
domain: nil,
timezone: nil,
public: nil,
members: %{value: fn s -> Enum.map(s.members, & &1.email) end}
members: %{value: fn s -> Enum.map(s.members, & &1.email) |> Enum.join(", ") end}
]
end
end