PhoenixKitPosts.PostComment (PhoenixKitPosts v0.1.3)

Copy Markdown View Source

Legacy schema for post comments.

Retained for backward compatibility with the phoenix_kit_post_comments table. New comments should use PhoenixKitComments.Comment instead.

Summary

Functions

Changeset for creating or updating a comment.

Check if comment is deleted.

Check if comment is published.

Check if comment is a reply (has parent).

Check if comment is top-level (no parent).

Types

t()

@type t() :: %PhoenixKitPosts.PostComment{
  __meta__: term(),
  children: [t()] | Ecto.Association.NotLoaded.t(),
  content: String.t(),
  depth: integer(),
  dislike_count: integer(),
  dislikes:
    [PhoenixKitPosts.CommentDislike.t()] | Ecto.Association.NotLoaded.t(),
  inserted_at: DateTime.t() | nil,
  like_count: integer(),
  likes: [PhoenixKitPosts.CommentLike.t()] | Ecto.Association.NotLoaded.t(),
  parent: t() | Ecto.Association.NotLoaded.t() | nil,
  parent_uuid: UUIDv7.t() | nil,
  post: PhoenixKitPosts.Post.t() | Ecto.Association.NotLoaded.t(),
  post_uuid: UUIDv7.t(),
  status: String.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(comment, attrs)

Changeset for creating or updating a comment.

Required Fields

  • post_uuid - Reference to post
  • user_uuid - Reference to commenter
  • content - Comment text

Validation Rules

  • Content must not be empty
  • Status must be valid (published/hidden/deleted/pending)
  • Depth automatically calculated from parent

deleted?(arg1)

Check if comment is deleted.

published?(arg1)

Check if comment is published.

reply?(post_comment)

Check if comment is a reply (has parent).

top_level?(post_comment)

Check if comment is top-level (no parent).