Schema for one-way follow relationships.
Represents a unidirectional relationship where one user follows another. No consent is required from the followed user.
Fields
follower_uuid- UUID of the user who is doing the followingfollowed_uuid- UUID of the user being followedinserted_at- When the follow was created
Examples
# User A follows User B
%Follow{
uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
follower_uuid: "019abc12-3456-7890-abcd-ef1234567890",
followed_uuid: "019abc12-9876-5432-abcd-ef1234567890",
inserted_at: ~N[2025-01-15 10:30:00]
}Business Rules
- Cannot follow yourself
- Cannot follow if blocked (either direction)
- Duplicate follows are prevented by unique constraint
Summary
Functions
Changeset for creating a follow relationship.
Types
@type t() :: %PhoenixKit.Modules.Connections.Follow{ __meta__: term(), followed: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), followed_uuid: UUIDv7.t(), follower: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), follower_uuid: UUIDv7.t(), inserted_at: DateTime.t() | nil, uuid: UUIDv7.t() | nil }
Functions
Changeset for creating a follow relationship.
Required Fields
follower_uuid- UUID of the user who is followingfollowed_uuid- UUID of the user being followed
Validation Rules
- Both user UUIDs are required
- Cannot follow yourself (follower_uuid != followed_uuid)
- Unique constraint on (follower_uuid, followed_uuid) pair