Add some tests

Also add a unicity constraint on the followers table

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-08-03 10:16:22 +02:00
parent 115d1d1a3e
commit e1e9b0fc11
9 changed files with 157 additions and 16 deletions

View File

@@ -197,6 +197,11 @@ defmodule Eventos.Actors.Actor do
end
end
@doc """
Get followers from an actor
If actor A and C both follow actor B, actor B's followers are A and C
"""
def get_followers(%Actor{id: actor_id} = _actor) do
Repo.all(
from(
@@ -208,6 +213,11 @@ defmodule Eventos.Actors.Actor do
)
end
@doc """
Get followings from an actor
If actor A follows actor B and C, actor A's followings are B and B
"""
def get_followings(%Actor{id: actor_id} = _actor) do
Repo.all(
from(