RegistrationCode

final class RegistrationCode : Model

A RegistrationCode associates a specific pre-generated code with a specific User account, as well as tracks when the association occurred.

To maintain accountability for conduct on Twit-arr, a user must first register their primary account before gaining the ability to post any content, either public or private. This is done with a unique registration code provided to each participant by Management. The full set of codes (which contain no identifying information) is provided to the Twit-arr admins prior to the event, and they are loaded by a Migration during system startup.

Properties

  • id

    The registration code’s ID, provisioned automatically.

    Declaration

    Swift

    @ID
    var id: UUID?
  • The registration code, normalized to lowercase without spaces.

    Declaration

    Swift

    @Field
    var code: String
  • Timestamp of the model’s last update, set automatically. Used to track when the code was assigned.

    Declaration

    Swift

    @Timestamp
    var updatedAt: Date?

Relations

  • The User to which this code is associated, if any.

    Declaration

    Swift

    @OptionalParent
    var user: User?

Initialization

  • Declaration

    Swift

    init()
  • Initializes a new RegistrationCode.

    Declaration

    Swift

    init(user: User? = nil, code: String)

    Parameters

    user

    The User to which the code is associated, nil if not yet assigned.

    code

    The registration code string.