migration to postgres

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 17:42:59 +00:00
co-authored by Claude Opus 4.6
parent 7f04ecd644
commit 500a70910e
54 changed files with 4016 additions and 264 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
import { createRouter } from '../../create-router';
import { settingsPath } from './server-settings';
import { readServerSettings, writeServerSettings } from 'officerdb';
import { readResourceConfig } from './resources';
type SttConfig = {
@@ -9,8 +9,8 @@ type SttConfig = {
export async function readSttConfig(): Promise<SttConfig | undefined> {
const config = await readResourceConfig('speech-to-text');
if (config.url) return { url: config.url };
// Fallback to legacy settings.json
const settings = await Bun.file(settingsPath).json().catch(() => ({}));
// Fallback to legacy DB settings
const settings = await readServerSettings();
return settings.stt as SttConfig | undefined;
}
@@ -24,9 +24,9 @@ sttRouter.get('/', async (ctx) => {
sttRouter.put('/', async (ctx) => {
const body = await ctx.req.json<SttConfig>();
const settings = await Bun.file(settingsPath).json().catch(() => ({}));
const settings = await readServerSettings();
settings.stt = body;
await Bun.write(settingsPath, JSON.stringify(settings, null, 2));
await writeServerSettings(settings);
return ctx.json({ success: true });
});