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_atis 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_atfield of the session