ForumPost
final class ForumPost : Model, Searchable
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.-
Declaration
Swift
static let schema: String
-
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
@ID var id: Int?
-
The text content of the post.
Declaration
Swift
@Field var text: String
-
The filenames of any images for the post.
Declaration
Swift
@OptionalField var images: [String]?
-
Moderators can set several statuses on forumPosts that modify editability and visibility.
Declaration
Swift
@Enum var moderationStatus: ContentModerationStatus
-
Timestamp of the model’s creation, set automatically.
Declaration
Swift
@Timestamp var createdAt: Date?
-
Timestamp of the model’s last update, set automatically.
Declaration
Swift
@Timestamp var updatedAt: Date?
-
Timestamp of the model’s soft-deletion, set automatically.
Declaration
Swift
@Timestamp var deletedAt: Date?
-
Is the post pinned within the forum.
Declaration
Swift
@Field var pinned: Bool
-
The child
ForumPostEdit
accountability records of the post.Declaration
Swift
@Children var edits: [ForumPostEdit]
-
The sibling
User
s who have “liked” the post.Declaration
Swift
@Siblings var likes: <<error type>>
-
Declaration
Swift
init()
-
Initializes a new ForumPost.
Declaration
Swift
init( forum: Forum, authorID: UUID, text: String, images: [String]? = nil ) throws
Parameters
forum
The post’s forum.
author
The author of the post.
text
The text content of the post.
image
The filename of any image content of the post.
-
Declaration
Swift
func contentTextStrings() -> [String]
-
Declaration
Swift
var reportType: ReportType { get }
-
Declaration
Swift
var authorUUID: UUID { get }
-
Declaration
Swift
var autoQuarantineThreshold: Int { get }