ToolController: impl signup

This commit is contained in:
Andrew Glaze
2025-05-23 13:26:13 -04:00
parent 49cd62da1d
commit c29f454881
7 changed files with 56 additions and 20 deletions

View File

@@ -17,11 +17,19 @@ final class Session: Model, @unchecked Sendable {
init() { }
init(account: Account, expires: Date, type: SessionType) throws {
self.id = UUID().uuidString
self.$account.id = try account.requireID()
convenience init(account: Account, expires: Date, type: SessionType) throws {
self.init(accountId: try account.requireID(), expires: expires, type: type)
}
init(accountId: Int, expires: Date, type: SessionType) {
self.$account.id = accountId
self.expires = expires
self.type = type
if (type != .VIEWER) {
self.id = UUID().uuidString
} else {
self.id = String(Int.random())
}
}
}