PhoenixKit.Modules.Posts.PostComment (phoenix_kit v1.7.43)

Copy Markdown View Source

Legacy schema for post comments.

Retained for backward compatibility with the phoenix_kit_post_comments table. New comments should use PhoenixKit.Modules.Comments.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() :: %PhoenixKit.Modules.Posts.PostComment{
  __meta__: term(),
  children: [t()] | Ecto.Association.NotLoaded.t(),
  content: String.t(),
  depth: integer(),
  dislike_count: integer(),
  dislikes:
    [PhoenixKit.Modules.Posts.CommentDislike.t()]
    | Ecto.Association.NotLoaded.t(),
  inserted_at: DateTime.t() | nil,
  like_count: integer(),
  likes:
    [PhoenixKit.Modules.Posts.CommentLike.t()] | Ecto.Association.NotLoaded.t(),
  parent: t() | Ecto.Association.NotLoaded.t() | nil,
  parent_id: UUIDv7.t() | nil,
  post: PhoenixKit.Modules.Posts.Post.t() | Ecto.Association.NotLoaded.t(),
  post_id: UUIDv7.t(),
  status: String.t(),
  updated_at: DateTime.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(comment, attrs)

Changeset for creating or updating a comment.

Required Fields

  • post_id - Reference to post
  • user_id - 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).