impl Account Table

This commit is contained in:
Andrew Glaze
2025-05-15 22:14:00 -04:00
parent 04c5660f7d
commit cada630298
14 changed files with 268 additions and 211 deletions

View File

@@ -0,0 +1,50 @@
import Fluent
import struct Foundation.UUID
/// Property wrappers interact poorly with `Sendable` checking, causing a warning for the `@ID` property
/// It is recommended you write your model with sendability checking on and then suppress the warning
/// afterwards with `@unchecked Sendable`.
final class Account: Model, @unchecked Sendable {
static let schema = "accounts"
@ID(custom: "id", generatedBy: .database)
var id: Int?
@Field(key: "app_id")
var appId: String
@Field(key: "first_login_time")
var firstLogin: Date
@Field(key: "reg_time")
var regDate: Date
@Field(key: "last_login_time")
var lastLogin: Date
@Field(key: "idp_alias")
var idpAlias: String
@Field(key: "idp_code")
var idpCode: String
@Field(key: "idp_id")
var idpId: String
@Field(key: "status")
var status: String
init() { }
init(id: Int? = nil, appId: String, idpAlias: String, idpCode: String, idpId: String, status: String) {
self.id = id
self.appId = appId
self.firstLogin = Date.now
self.idpAlias = idpAlias
self.idpCode = idpCode
self.idpId = idpId
self.regDate = Date.now
self.lastLogin = Date.now
self.status = status
}
}