feat: admin-configurable FINRA download URL

- Add finra_config singleton table (base_url + updated_at)
- Add getFinraBaseUrl() and setFinraBaseUrl() to admin.ts
  Resolution order: DB config > env FINRA_BASE_URL > built-in default
- Add finraConfig query + finraConfigUpdate mutation to admin tRPC router
- Update FinraIngestService.downloadAndIngestFinra to accept optional baseUrl
  param; falls back to getFinraBaseUrl(db) when omitted
- FinraBulkAdapter resolves URL implicitly via the service (no adapter change)
- Add migration #10 for existing DBs
This commit is contained in:
Investor Flow Build
2026-07-25 13:11:50 -04:00
parent 0b9df1e9d3
commit 8a00363dd0
5 changed files with 48 additions and 5 deletions
+11
View File
@@ -232,6 +232,17 @@ function runMigrations(db: DatabaseSync): void {
)
`);
} catch { /* ignore */ }
// 10. FINRA config table for admin-configurable download URL.
try {
db.exec(`
CREATE TABLE IF NOT EXISTS finra_config (
id TEXT PRIMARY KEY DEFAULT 'singleton',
base_url TEXT NOT NULL DEFAULT 'https://www.finra.org/sites/default/files',
updated_at TEXT NOT NULL
)
`);
} catch { /* ignore */ }
}
let _db: DatabaseSync | null = null;