Category

final class Category : Model, @unchecked Sendable

Categories are used to organize Twit-arr Forums into a managable structure. All Forums belong to a single Category.

Each Category has a minimum userAccessLevel required to view the Category or view forums in the Category. Each Category also has a minimum userAccessLevel required to create new forums in the Category.

See

See Also: CategoryData the DTO for returning info on Categories.

See

See Also: CreateCategorySchema the Migration for creating the Category table in the database.

Properties

  • id

    The category’s ID.

    Declaration

    Swift

    @Category
    .ID var id: UUID? { get set }
  • The title of the category.

    Declaration

    Swift

    @Category
    .Field var title: String { get set }
  • A short string describing what the Category is for. Color commentary for the category.

    Declaration

    Swift

    @Category
    .Field var purpose: String { get set }
  • TRUE if this category holds forums for Events.

    Declaration

    Swift

    @Category
    .Field var isEventCategory: Bool { get set }
  • Minimum access level to view posts in this category. Usually set to .quarantined. But, a category reserved for moderators only could have this set to .moderator.

    Declaration

    Swift

    @Category
    .Enum var accessLevelToView: UserAccessLevel { get set }
  • Minimum access level to create threads in this category. Usually set to .verified. Setting this to a value less than verified won’t work as those users cannot create any content. This setting does not govern posting in existing threads. An admin could create a thread in an admin-only forum and leave it unlocked so that anyone that can see the thread can post in it. Or, they could lock the thread, preventing posting.

    Declaration

    Swift

    @Category
    .Enum var accessLevelToCreate: UserAccessLevel { get set }
  • If non-nil, the UserRoleType that a User is required to posess in order to view items in this category. This test is bypassed for Moderator users. For everyone else, both the Role test and the accessLevel test must pass in order to view.

    Declaration

    Swift

    @Category
    .OptionalEnum var requiredRole: UserRoleType? { get set }
  • The number of forums containted in this Category. Should always be equal to forums.count.

    Declaration

    Swift

    @Category
    .Field var forumCount: Int32 { get set }
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

    @Category
    .Timestamp var createdAt: Date? { get set }
  • Timestamp of the model’s last update, set automatically.

    Declaration

    Swift

    @Category
    .Timestamp var updatedAt: Date? { get set }
  • Timestamp of the model’s soft-deletion, set automatically.

    Declaration

    Swift

    @Category
    .Timestamp var deletedAt: Date? { get set }

Relations

Initialization