Both are subclasses of an abstract User class which contains almost everything interesting.
26 lines
552 B
TypeScript
26 lines
552 B
TypeScript
import { AuthService } from "../auth";
|
|
import { getCurrentUser } from "../context";
|
|
import { PostgresAuthStore } from "../database";
|
|
import type { User } from "../user";
|
|
import { html, redirect, render } from "./util";
|
|
|
|
const util = { html, redirect, render };
|
|
|
|
const session = {
|
|
getUser: (): User => {
|
|
return getCurrentUser();
|
|
},
|
|
};
|
|
|
|
// Initialize auth with PostgreSQL store
|
|
const authStore = new PostgresAuthStore();
|
|
const auth = new AuthService(authStore);
|
|
|
|
const request = {
|
|
auth,
|
|
session,
|
|
util,
|
|
};
|
|
|
|
export { request };
|