Junction schema for post media attachments.
Links posts to uploaded files (images/videos) with ordering and captions. Enables ordered image galleries in posts with per-image captions.
Fields
post_uuid- Reference to the postfile_uuid- Reference to the uploaded file (PhoenixKit.Storage.File)position- Display order (1, 2, 3, etc.)caption- Optional caption/alt text for the image
Examples
# First image in post
%PostMedia{
post_uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
file_uuid: "018e3c4a-1234-5678-abcd-ef1234567890",
position: 1,
caption: "Beautiful sunset at the beach"
}
# Second image
%PostMedia{
post_uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
file_uuid: "018e3c4a-5678-1234-abcd-ef1234567890",
position: 2,
caption: nil
}
Summary
Functions
Changeset for creating or updating post media.
Types
@type t() :: %PhoenixKit.Modules.Posts.PostMedia{ __meta__: term(), caption: String.t() | nil, file: PhoenixKit.Modules.Storage.File.t() | Ecto.Association.NotLoaded.t(), file_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, uuid: UUIDv7.t() | nil }