diff --git a/lib/plausible/site/memberships/accept_invitation.ex b/lib/plausible/site/memberships/accept_invitation.ex index b7839939bf..8c4136d0dc 100644 --- a/lib/plausible/site/memberships/accept_invitation.ex +++ b/lib/plausible/site/memberships/accept_invitation.ex @@ -32,8 +32,10 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do | Ecto.Changeset.t() | :no_plan + @type membership :: %Plausible.Teams.Membership{} + @spec bulk_transfer_ownership_direct([Site.t()], Auth.User.t()) :: - {:ok, [Site.Membership.t()]} | {:error, transfer_error()} + {:ok, [membership]} | {:error, transfer_error()} def bulk_transfer_ownership_direct(sites, new_owner) do Repo.transaction(fn -> for site <- sites do diff --git a/lib/plausible/sites.ex b/lib/plausible/sites.ex index a56f5db781..afc531a590 100644 --- a/lib/plausible/sites.ex +++ b/lib/plausible/sites.ex @@ -346,40 +346,4 @@ defmodule Plausible.Sites do select: s ) end - - def owned_sites_locked?(user) do - user - |> owned_sites_query() - |> where([s], s.locked == true) - |> Repo.exists?() - end - - def owned_sites_count(user) do - user - |> owned_sites_query() - |> Repo.aggregate(:count) - end - - def owned_sites_domains(user) do - user - |> owned_sites_query() - |> select([site], site.domain) - |> Repo.all() - end - - def owned_site_ids(user) do - user - |> owned_sites_query() - |> select([site], site.id) - |> Repo.all() - end - - defp owned_sites_query(user) do - from(s in Site, - join: sm in Site.Membership, - on: sm.site_id == s.id, - where: sm.role == :owner, - where: sm.user_id == ^user.id - ) - end end