fix: backfill symbol_demand for sidebar-added symbols + analyst ratings schema fix
- Add await ctx.cache.subscribe() to addSymbol mutation so symbols added via the sidebar get registered in symbol_demand and yfinance jobs are queued immediately - Backfill PEP, WYNN, STZ, CELH into symbol_demand + adapter_queue - Upgrade yahoo-finance2 3.15.3 -> 3.15.4 and pass validateResult:false to quoteSummary() to handle Yahoo schema drift - Add error detail logging for analyst ratings schema failures - Update .gitignore with common ignores
This commit is contained in:
@@ -5,6 +5,7 @@ import { randomUUID, randomBytes, scryptSync, timingSafeEqual, createHmac } from
|
||||
import type { DatabaseSync } from 'node:sqlite';
|
||||
import type { CacheRepository } from '../cache/CacheRepository.ts';
|
||||
import type { AdapterQueue } from '../queue/AdapterQueue.ts';
|
||||
import type { XCookieAdapter } from '../adapters/XCookieAdapter.ts';
|
||||
|
||||
export const SESSION_COOKIE = 'iflow_session';
|
||||
export const OAUTH_STATE_COOKIE = 'iflow_oauth_state';
|
||||
@@ -21,6 +22,7 @@ export interface Context {
|
||||
db: DatabaseSync;
|
||||
cache: CacheRepository;
|
||||
queue: AdapterQueue;
|
||||
xAdapter: XCookieAdapter | null;
|
||||
resHeaders: Headers; // mutable; procedures append Set-Cookie here (applied to Response by the fetch adapter)
|
||||
userId: string | null; // resolved from the session cookie; null = unauthenticated
|
||||
cookies: Record<string, string>; // parsed request cookies (session + oauth state)
|
||||
@@ -102,13 +104,14 @@ export function verifyPassword(pw: string, stored: string): boolean {
|
||||
}
|
||||
|
||||
// ----- context factory: 1f wires real db+cache; tests inject in-memory -----
|
||||
export function makeCreateContext(opts: { db: DatabaseSync; cache: CacheRepository; queue: AdapterQueue }) {
|
||||
export function makeCreateContext(opts: { db: DatabaseSync; cache: CacheRepository; queue: AdapterQueue; xAdapter?: XCookieAdapter | null }) {
|
||||
return ({ req, resHeaders }: CreateContextOpts): Context => {
|
||||
const cookies = parseCookies(req);
|
||||
return {
|
||||
db: opts.db,
|
||||
cache: opts.cache,
|
||||
queue: opts.queue,
|
||||
xAdapter: opts.xAdapter ?? null,
|
||||
resHeaders,
|
||||
cookies,
|
||||
userId: resolveSessionUserId(opts.db, req),
|
||||
|
||||
Reference in New Issue
Block a user