app/db/settings.ts
18 lines and 2 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| getSetting | 6 to 13 | 2 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
| setSetting | 15 to 20 | 1 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/db/client.ts, app/db/schema.ts. Imported by app/db/index.ts, app/lib/llms/save.server.ts.
Source
// The key-value settings table.
import { eq } from "drizzle-orm";
import { settings } from "./schema";
import { getDb } from "./client";
export async function getSetting(env: Env, key: string) {
const rows = await getDb(env)
.select({ value: settings.value })
.from(settings)
.where(eq(settings.key, key))
.limit(1);
return rows[0]?.value ?? null;
}
export async function setSetting(env: Env, key: string, value: string) {
await getDb(env)
.insert(settings)
.values({ key, value })
.onConflictDoUpdate({ target: settings.key, set: { value } });
}