Forum

final class Forum : Model, Searchable
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

    @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

Relations

Initialization