Add email to user model

This commit is contained in:
Christoph Hagen 2022-10-11 12:04:30 +02:00
parent 16ab0fd6d3
commit e41a5fc75c
2 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,7 @@ struct UserTableMigration: Migration {
.field(User.Key.hash.key, .string, .required) .field(User.Key.hash.key, .string, .required)
.field(User.Key.points.key, .int, .required) .field(User.Key.points.key, .int, .required)
.field(User.Key.table.key, .uuid, .references(Table.schema, Table.Key.id.key)) .field(User.Key.table.key, .uuid, .references(Table.schema, Table.Key.id.key))
.field(User.Key.recoveryEmail.key, .string)
.create() .create()
let two = database.enum(Table.Key.language.rawValue) let two = database.enum(Table.Key.language.rawValue)
.case(SupportedLanguage.german.rawValue) .case(SupportedLanguage.german.rawValue)

View File

@ -23,6 +23,7 @@ final class User: Model {
case hash = "hash" case hash = "hash"
case points = "points" case points = "points"
case table = "table_id" case table = "table_id"
case recoveryEmail = "email"
var key: FieldKey { var key: FieldKey {
.init(stringLiteral: rawValue) .init(stringLiteral: rawValue)
@ -44,6 +45,9 @@ final class User: Model {
@Field(.hash) @Field(.hash)
var passwordHash: String var passwordHash: String
@Field(.recoveryEmail)
var recoveryEmail: String?
/// The user's total points /// The user's total points
@Field(.points) @Field(.points)
var points: Int var points: Int