mirror of
https://github.com/plausible/analytics.git
synced 2024-12-01 03:48:35 +03:00
18 lines
369 B
Elixir
18 lines
369 B
Elixir
defmodule PlausibleWeb.Api.InternalController do
|
|
use PlausibleWeb, :controller
|
|
use Plausible.Repo
|
|
|
|
def domain_status(conn, %{"domain" => domain}) do
|
|
has_pageviews = Repo.exists?(
|
|
from e in Plausible.Event,
|
|
where: e.hostname == ^domain
|
|
)
|
|
|
|
if has_pageviews do
|
|
json(conn, "READY")
|
|
else
|
|
json(conn, "WAITING")
|
|
end
|
|
end
|
|
end
|