end
def user_follow(conn, %{"follower" => follower_nick, "followed" => followed_nick}) do
- with %User{} = follower <- Repo.get_by(User, %{nickname: follower_nick}),
- %User{} = followed <- Repo.get_by(User, %{nickname: followed_nick}) do
+ with %User{} = follower <- User.get_by_nickname(follower_nick),
+ %User{} = followed <- User.get_by_nickname(followed_nick) do
User.follow(follower, followed)
end
end
def user_unfollow(conn, %{"follower" => follower_nick, "followed" => followed_nick}) do
- with %User{} = follower <- Repo.get_by(User, %{nickname: follower_nick}),
- %User{} = followed <- Repo.get_by(User, %{nickname: followed_nick}) do
+ with %User{} = follower <- User.get_by_nickname(follower_nick),
+ %User{} = followed <- User.get_by_nickname(followed_nick) do
User.unfollow(follower, followed)
end