View Source Squeeze.Social (OpenPace v0.0.1)

The Social context.

Link to this section Summary

Functions

Returns the list of follows.

Returns the list of follows.

Link to this section Functions

Link to this function

follow_user(follower, followee)

View Source

Follows a user.

follow_user(Alice, Bob) # Alice follows Bob

  • Create a follow with follower == Alice and followee == Bob
  • Increment Bob's follower_count
  • Increment Alice's following_count

examples

Examples

iex> follow_user(user1, user2)
{:ok, %User{}}

Returns the list of follows.

examples

Examples

iex> list_followers(user)
[%User{}, ...]

Returns the list of follows.

examples

Examples

iex> list_following(user) [%User{}, ...]

Link to this function

unfollow_user(follower, followee)

View Source

Unfollows a user.

unfollow_user(Alice, Bob) # Alice unfollows Bob

  • Delete the follow with follower == Alice and followee == Bob
  • Decrement Bob's follower_count
  • Decrement Alice's following_count

examples

Examples

iex> unfollow_user(user1, user2)
{:ok, %Follow{}}