Add & improve some typespecs
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
35b83950d4
commit
0f8358b96a
@ -45,7 +45,7 @@ defmodule Mobilizon.Actors.Actor do
|
|||||||
suspended: boolean,
|
suspended: boolean,
|
||||||
avatar: File.t() | nil,
|
avatar: File.t() | nil,
|
||||||
banner: File.t() | nil,
|
banner: File.t() | nil,
|
||||||
user: User.t(),
|
user: User.t() | nil,
|
||||||
followers: [Follower.t()],
|
followers: [Follower.t()],
|
||||||
followings: [Follower.t()],
|
followings: [Follower.t()],
|
||||||
organized_events: [Event.t()],
|
organized_events: [Event.t()],
|
||||||
|
@ -819,21 +819,22 @@ defmodule Mobilizon.Actors do
|
|||||||
@doc """
|
@doc """
|
||||||
Returns the list of members for an actor.
|
Returns the list of members for an actor.
|
||||||
"""
|
"""
|
||||||
@spec list_members_for_actor(Actor.t(), integer | nil, integer | nil) :: Page.t()
|
@spec list_members_for_actor(Actor.t(), integer | nil, integer | nil) :: Page.t(Member.t())
|
||||||
def list_members_for_actor(%Actor{id: actor_id}, page \\ nil, limit \\ nil) do
|
def list_members_for_actor(%Actor{id: actor_id}, page \\ nil, limit \\ nil) do
|
||||||
actor_id
|
actor_id
|
||||||
|> members_for_actor_query()
|
|> members_for_actor_query()
|
||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec list_all_local_members_for_group(Actor.t()) :: Member.t()
|
@spec list_all_local_members_for_group(Actor.t()) :: list(Member.t())
|
||||||
def list_all_local_members_for_group(%Actor{id: group_id, type: :Group} = _group) do
|
def list_all_local_members_for_group(%Actor{id: group_id, type: :Group} = _group) do
|
||||||
group_id
|
group_id
|
||||||
|> group_internal_member_query()
|
|> group_internal_member_query()
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec list_local_members_for_group(Actor.t(), integer | nil, integer | nil) :: Page.t()
|
@spec list_local_members_for_group(Actor.t(), integer | nil, integer | nil) ::
|
||||||
|
Page.t(Member.t())
|
||||||
def list_local_members_for_group(
|
def list_local_members_for_group(
|
||||||
%Actor{id: group_id, type: :Group} = _group,
|
%Actor{id: group_id, type: :Group} = _group,
|
||||||
page \\ nil,
|
page \\ nil,
|
||||||
@ -844,7 +845,8 @@ defmodule Mobilizon.Actors do
|
|||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec list_remote_members_for_group(Actor.t(), integer | nil, integer | nil) :: Page.t()
|
@spec list_remote_members_for_group(Actor.t(), integer | nil, integer | nil) ::
|
||||||
|
Page.t(Member.t())
|
||||||
def list_remote_members_for_group(
|
def list_remote_members_for_group(
|
||||||
%Actor{id: group_id, type: :Group} = _group,
|
%Actor{id: group_id, type: :Group} = _group,
|
||||||
page \\ nil,
|
page \\ nil,
|
||||||
@ -858,7 +860,8 @@ defmodule Mobilizon.Actors do
|
|||||||
@doc """
|
@doc """
|
||||||
Returns a paginated list of members for a group.
|
Returns a paginated list of members for a group.
|
||||||
"""
|
"""
|
||||||
@spec list_members_for_group(Actor.t(), list(atom()), integer | nil, integer | nil) :: Page.t()
|
@spec list_members_for_group(Actor.t(), list(atom()), integer | nil, integer | nil) ::
|
||||||
|
Page.t(Member.t())
|
||||||
def list_members_for_group(
|
def list_members_for_group(
|
||||||
%Actor{id: group_id, type: :Group},
|
%Actor{id: group_id, type: :Group},
|
||||||
roles \\ [],
|
roles \\ [],
|
||||||
|
Loading…
Reference in New Issue
Block a user