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_uuid- Reference to the postuser_uuid- Reference to the mentioned usermention_type- contributor/mention
Examples
# Contributor mention
%PostMention{
post_uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
user_uuid: "018e3c4a-1234-5678-abcd-ef1234567890",
mention_type: "contributor"
}
# Regular mention
%PostMention{
post_uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
user_uuid: "018e3c4a-5678-1234-abcd-ef1234567890",
mention_type: "mention"
}
Summary
Types
@type t() :: %PhoenixKit.Modules.Posts.PostMention{ __meta__: term(), inserted_at: DateTime.t() | nil, mention_type: String.t(), post: PhoenixKit.Modules.Posts.Post.t() | Ecto.Association.NotLoaded.t(), post_uuid: UUIDv7.t(), updated_at: DateTime.t() | nil, user: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), user_uuid: UUIDv7.t() | nil, uuid: UUIDv7.t() | nil }
Functions
Changeset for creating or updating a mention.
Required Fields
post_uuid- Reference to postuser_uuid- Reference to mentioned usermention_type- Must be: "contributor" or "mention"
Validation Rules
- Mention type must be valid (contributor/mention)
- Unique constraint on (post_uuid, user_uuid) - one mention per user per post
Check if mention is a contributor.