Forum
final class Forum : Model, Searchable, @unchecked Sendable
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
@Forum .ID var id: UUID? { get set }
-
The title of the forum.
Declaration
Swift
@Forum .Field var title: String { get set }
-
The creation time of the last post added to this forum. Used to sort forums. Edits to posts don’t count.
Declaration
Swift
@Forum .Field var lastPostTime: Date { get set }
-
The ID of the last post added to this forum. Could be empty.
Declaration
Swift
@Forum .Field var lastPostID: Int? { get set }
-
Moderators can set several statuses on forums that modify editability and visibility.
Declaration
Swift
@Forum .Enum var moderationStatus: ContentModerationStatus { get set }
-
Timestamp of the model’s creation, set automatically.
Declaration
Swift
@Forum .Timestamp var createdAt: Date? { get set }
-
Timestamp of the model’s last update, set automatically.
Declaration
Swift
@Forum .Timestamp var updatedAt: Date? { get set }
-
Timestamp of the model’s soft-deletion, set automatically.
Declaration
Swift
@Forum .Timestamp var deletedAt: Date? { get set }
-
Is the forum pinned within the category.
Declaration
Swift
@Forum .Field var pinned: Bool { get set }
-
The
ForumReaders
pivots contain read counts for each user who has read this forum thread.Declaration
Swift
@Forum .Siblings var readers: [User] { get set }
-
If this forum is for discussing an event on the schedule, this is the event that’s the topic of the forum.
Declaration
Swift
@Forum .OptionalChild var scheduleEvent: Event? { get set }
-
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 }