impl Account Table
This commit is contained in:
50
Sources/stella/Models/Account.swift
Normal file
50
Sources/stella/Models/Account.swift
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user