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 OcrConfig = {
@@ -10,8 +10,8 @@ type OcrConfig = {
export async function readOcrConfig(): Promise<OcrConfig | undefined> {
const config = await readResourceConfig('optical-character-recognition');
if (config.url) return { url: config.url, model: config.model ?? '' };
// Fallback to legacy settings.json
const settings = await Bun.file(settingsPath).json().catch(() => ({}));
// Fallback to legacy DB settings
const settings = await readServerSettings();
return settings.ocr as OcrConfig | undefined;
}
@@ -25,9 +25,9 @@ ocrRouter.get('/', async (ctx) => {
ocrRouter.put('/', async (ctx) => {
const body = await ctx.req.json<OcrConfig>();
const settings = await Bun.file(settingsPath).json().catch(() => ({}));
const settings = await readServerSettings();
settings.ocr = body;
await Bun.write(settingsPath, JSON.stringify(settings, null, 2));
await writeServerSettings(settings);
return ctx.json({ success: true });
});