Adapter
Represents a database adapter.
Definition
interface Adapter {
deleteExpiredSessions(): Promise<void>;
deleteSession(sessionId: string): Promise<void>;
deleteUserSessions(userId: UserId): Promise<void>;
getSessionAndUser(
sessionId: string
): Promise<[session: DatabaseSession | null, user: DatabaseUser | null]>;
getUserSessions(userId: UserId): Promise<DatabaseSession[]>;
setSession(session: DatabaseSession): Promise<void>;
updateSessionExpiration(sessionId: string, expiresAt: Date): Promise<void>;
}
Methods
deleteExpiredSessions
: Deletes all sessions whereexpires_at
is equal to or less than current timestamp (machine time)deleteSession()
: Deletes the sessiondeleteUserSessions()
: Deletes all sessions linked to the usergetSessionAndUser()
: Returns the session and the user linked to the sessiongetUserSessions()
: Returns all sessions linked to a usersetSession()
: Inserts the sessionupdateSessionExpiration()
: Updates theexpires_at
field of the session