Forum
final class Forum : Model, Searchable
extension Forum: Reportable
A collection of ForumPost
s on a single topic. Only the forum’s creator or a moderator can edit a forum’s title.
Only moderators can can change a forum’s moderationStatus
.
See
See Also: ForumData the DTO for returning detailed info on Forums.See
See Also: ForumListData the DTO for returning basic info on Forums. Mostly, ForumListData does not include posts.See
See Also: ForumCreateData the DTO for creating forums.See
See Also: CreateForumSchema the Migration for creating the Forum table in the database.-
Declaration
Swift
static let schema: String
-
The forum’s ID.
Declaration
Swift
@ID var id: UUID?
-
The title of the forum.
Declaration
Swift
@Field var title: String
-
The creation time of the last post added to this forum. Used to sort forums. Edits to posts don’t count.
Declaration
Swift
@Field var lastPostTime: Date
-
The ID of the last post added to this forum. Could be empty.
Declaration
Swift
@Field var lastPostID: Int?
-
Moderators can set several statuses on forums 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 forum pinned within the category.
Declaration
Swift
@Field var pinned: Bool
-
The
ForumReaders
pivots contain read counts for each user who has read this forum thread.Declaration
Swift
@Siblings var readers: [User]
-
If this forum is for discussing an event on the schedule, this is the event that’s the topic of the forum.
Declaration
Swift
@OptionalChild var scheduleEvent: Event?
-
Declaration
Swift
init()
-
Initializes a new Forum.
Declaration
Swift
init(title: String, category: Category, creatorID: UUID, isLocked: Bool = false) throws
Parameters
title
The title for the forum.
categoryID
The category to which the forum belongs.
creatorID
The ID of the creator of the forum.
isLocked
Whether the forum is administratively locked.
-
The report type for
Forum
reports.Declaration
Swift
var reportType: ReportType { get }
-
Declaration
Swift
var authorUUID: UUID { get }
-
Declaration
Swift
var autoQuarantineThreshold: Int { get }