fixed up qm and added types to BaseHandler for typesafety

This commit is contained in:
Boki 2025-06-28 21:49:33 -04:00
parent 87b1cad4f5
commit 2e86598262
20 changed files with 164 additions and 109 deletions

View file

@ -2,10 +2,11 @@
* QM Prices Actions - Fetch and update daily price data
*/
import type { BaseHandler, ExecutionContext } from '@stock-bot/handlers';
import type { ExecutionContext } from '@stock-bot/handlers';
import type { QMHandler } from '../qm.handler';
import { QM_CONFIG, QM_SESSION_IDS } from '../shared/config';
import { QMSessionManager } from '../shared/session-manager';
import { QMOperationTracker } from '../shared/operation-tracker';
import { QMSessionManager } from '../shared/session-manager';
// Cache tracker instance
let operationTracker: QMOperationTracker | null = null;
@ -13,7 +14,7 @@ let operationTracker: QMOperationTracker | null = null;
/**
* Get or initialize the operation tracker
*/
async function getOperationTracker(handler: BaseHandler): Promise<QMOperationTracker> {
async function getOperationTracker(handler: QMHandler): Promise<QMOperationTracker> {
if (!operationTracker) {
const { initializeQMOperations } = await import('../shared/operation-registry');
operationTracker = await initializeQMOperations(handler.mongodb, handler.logger);
@ -25,7 +26,7 @@ async function getOperationTracker(handler: BaseHandler): Promise<QMOperationTra
* Update daily prices for a single symbol
*/
export async function updatePrices(
this: BaseHandler,
this: QMHandler,
input: {
symbol: string;
symbolId: number;
@ -164,7 +165,7 @@ export async function updatePrices(
* Schedule price updates for symbols that need refreshing
*/
export async function schedulePriceUpdates(
this: BaseHandler,
this: QMHandler,
input: {
limit?: number;
forceUpdate?: boolean;