ForumPost

final class ForumPost : Model, Searchable, @unchecked Sendable
extension ForumPost: ContentFilterable
extension ForumPost: Reportable

An individual post within a Forum. A ForumPost must contain text content and may also contain image content.

Posts have a moderationStatus that moderators can change to perform moderation actdions.

When a post is edited, a ForumPostEdit is created to save the pre-edit state of the post.

See

See Also: PostData the DTO for returning basic data on ForumPosts.

See

See Also: PostDetailData the DTO for returning extended data on ForumPosts.

See

See Also: PostContentData the DTO for creating ForumPosts.

See

See Also: CreateForumPostSchema the Migration for creating the ForumPost table in the database.

Properties

  • id

    The post’s ID. Sorting posts in a thread by ID should produce the correct ordering, but post IDs are unique through all forums, and won’t be sequential in any forum.

    Declaration

    Swift

    @ForumPost
    .ID var id: Int? { get set }
  • The text content of the post.

    Declaration

    Swift

    @ForumPost
    .Field var text: String { get set }
  • The filenames of any images for the post.

    Declaration

    Swift

    @ForumPost
    .OptionalField var images: [String]? { get set }
  • Moderators can set several statuses on forumPosts that modify editability and visibility.

    Declaration

    Swift

    @ForumPost
    .Enum var moderationStatus: ContentModerationStatus { get set }
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

    @ForumPost
    .Timestamp var createdAt: Date? { get set }
  • Timestamp of the model’s last update, set automatically.

    Declaration

    Swift

    @ForumPost
    .Timestamp var updatedAt: Date? { get set }
  • Timestamp of the model’s soft-deletion, set automatically.

    Declaration

    Swift

    @ForumPost
    .Timestamp var deletedAt: Date? { get set }
  • Is the post pinned within the forum.

    Declaration

    Swift

    @ForumPost
    .Field var pinned: Bool { get set }

Relations

Initialization