Schema for post mentions (tagged users).
Tags users related to a post - either as contributors who helped create it, or mentions of people featured in the content.
Mention Types
contributor- User helped create/contribute to the postmention- User is mentioned/tagged in the post
Fields
post_id- Reference to the postuser_id- Reference to the mentioned usermention_type- contributor/mention
Examples
# Contributor mention
%PostMention{
post_id: "018e3c4a-9f6b-7890-abcd-ef1234567890",
user_id: 42,
mention_type: "contributor"
}
# Regular mention
%PostMention{
post_id: "018e3c4a-9f6b-7890-abcd-ef1234567890",
user_id: 15,
mention_type: "mention"
}
Summary
Types
@type t() :: %PhoenixKit.Modules.Posts.PostMention{ __meta__: term(), inserted_at: NaiveDateTime.t() | nil, mention_type: String.t(), post: PhoenixKit.Modules.Posts.Post.t() | Ecto.Association.NotLoaded.t(), post_id: UUIDv7.t(), updated_at: NaiveDateTime.t() | nil, user: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), user_id: integer() | nil, user_uuid: UUIDv7.t() | nil, uuid: UUIDv7.t() | nil }
Functions
Changeset for creating or updating a mention.
Required Fields
post_id- Reference to postuser_id- Reference to mentioned usermention_type- Must be: "contributor" or "mention"
Validation Rules
- Mention type must be valid (contributor/mention)
- Unique constraint on (post_id, user_id) - one mention per user per post
Check if mention is a contributor.