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.
-
Declaration
Swift
static let schema: String
-
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
-
TRUE if this reg code is allocated for members of TwitarrTeam to give to Discord users on the preprod server. Accounts created from these regcodes are not valid on prod (and Prod should not have any regcodes with this flag set to true).
Declaration
Swift
@Field var isDiscordUser: Bool
-
When this regcode gets given to a Discord user, the username of the user that has it. This ties the account they eventually make to the user’s Discord username. nil if this regcode has yet to be allocated to anyone. Should always be nil on production server.
Declaration
Swift
@OptionalField var discordUsername: String?
-
Timestamp of the model’s last update, set automatically. Used to track when the code was assigned.
Declaration
Swift
@Timestamp var updatedAt: Date?
-
The User to which this code is associated, if any.
Declaration
Swift
@OptionalParent var user: User?
-
Declaration
Swift
init()
-
Initializes a new RegistrationCode.
Declaration
Swift
init(code: String, isForDiscord: Bool = false)
Parameters
code
The registration code string.