drop db interface, use kysely instead for more more flexibility (at the cost of more coupling)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { PageContextServer } from "vike/types";
|
||||
import { createCaller } from "../../../server/trpc/chat.js";
|
||||
import { getDb } from "../../../database/postgres.js";
|
||||
import { getDbClient } from "../../../database/postgres.js";
|
||||
import { getOpenrouter } from "../../../server/provider.js";
|
||||
import { env } from "../../../server/env.js";
|
||||
|
||||
@@ -9,14 +9,14 @@ export type Data = Awaited<ReturnType<typeof data>>;
|
||||
export const data = async (pageContext: PageContextServer) => {
|
||||
const { id } = pageContext.routeParams;
|
||||
const caller = createCaller({
|
||||
db: getDb(
|
||||
(pageContext.env?.POSTGRES_CONNECTION_STRING ||
|
||||
env.POSTGRES_CONNECTION_STRING) as string
|
||||
),
|
||||
openrouter: getOpenrouter(
|
||||
(pageContext.env?.OPENROUTER_API_KEY || env.OPENROUTER_API_KEY) as string
|
||||
),
|
||||
// jwt: pageContext.,
|
||||
dbClient: getDbClient(
|
||||
(pageContext.env?.POSTGRES_CONNECTION_STRING ||
|
||||
env.POSTGRES_CONNECTION_STRING) as string
|
||||
),
|
||||
});
|
||||
|
||||
const [
|
||||
|
||||
Reference in New Issue
Block a user