PhoenixKit.Modules.Posts.PostGroupAssignment (phoenix_kit v1.7.71)

Copy Markdown View Source

Junction schema for post-group assignments.

Many-to-many relationship between posts and groups. A post can be in multiple groups, and a group can contain multiple posts. Position allows manual ordering within each group.

Fields

  • post_uuid - Reference to the post
  • group_uuid - Reference to the group
  • position - Display order within the group (0, 1, 2, etc.)

Examples

# First post in group
%PostGroupAssignment{
  post_uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
  group_uuid: "018e3c4a-1234-5678-abcd-ef1234567890",
  position: 0
}

# Second post in group
%PostGroupAssignment{
  post_uuid: "018e3c4a-5678-1234-abcd-ef1234567890",
  group_uuid: "018e3c4a-1234-5678-abcd-ef1234567890",
  position: 1
}

Summary

Functions

Changeset for creating a post-group assignment.

Types

t()

@type t() :: %PhoenixKit.Modules.Posts.PostGroupAssignment{
  __meta__: term(),
  group:
    PhoenixKit.Modules.Posts.PostGroup.t() | Ecto.Association.NotLoaded.t(),
  group_uuid: UUIDv7.t(),
  inserted_at: DateTime.t() | nil,
  position: integer(),
  post: PhoenixKit.Modules.Posts.Post.t() | Ecto.Association.NotLoaded.t(),
  post_uuid: UUIDv7.t(),
  updated_at: DateTime.t() | nil
}

Functions

changeset(assignment, attrs)

Changeset for creating a post-group assignment.

Required Fields

  • post_uuid - Reference to post
  • group_uuid - Reference to group

Validation Rules

  • Position must be >= 0
  • Unique constraint on (post_uuid, group_uuid) - post can't be in same group twice