Rework user types: create AuthenticatedUser and AnonymousUser class
Both are subclasses of an abstract User class which contains almost everything interesting.
This commit is contained in:
@@ -18,7 +18,7 @@ import type {
|
||||
} from "./auth/store";
|
||||
import { generateToken, hashToken } from "./auth/token";
|
||||
import type { SessionData, TokenId } from "./auth/types";
|
||||
import { User, type UserId } from "./user";
|
||||
import { AuthenticatedUser, type User, type UserId } from "./user";
|
||||
|
||||
// Connection configuration
|
||||
const connectionConfig = {
|
||||
@@ -367,7 +367,7 @@ class PostgresAuthStore implements AuthStore {
|
||||
|
||||
// Helper to convert database row to User object
|
||||
private rowToUser(row: Selectable<UsersTable>): User {
|
||||
return new User({
|
||||
return new AuthenticatedUser({
|
||||
id: row.id,
|
||||
email: row.email,
|
||||
displayName: row.display_name ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user