Forum

final class Forum : Model, Searchable, @unchecked Sendable
extension Forum: Reportable

A collection of ForumPosts 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.

Properties

  • id

    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 }

Relations

Initialization