fixed up qm and added types to BaseHandler for typesafety
This commit is contained in:
parent
87b1cad4f5
commit
2e86598262
20 changed files with 164 additions and 109 deletions
|
|
@ -2,10 +2,11 @@
|
|||
* QM Financials Actions - Fetch and update financial statements
|
||||
*/
|
||||
|
||||
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 financials for a single symbol
|
||||
*/
|
||||
export async function updateFinancials(
|
||||
this: BaseHandler,
|
||||
this: QMHandler,
|
||||
input: {
|
||||
symbol: string;
|
||||
symbolId: number;
|
||||
|
|
@ -136,7 +137,6 @@ export async function updateFinancials(
|
|||
const tracker = await getOperationTracker(this);
|
||||
await tracker.updateSymbolOperation(symbol, 'financials_update', {
|
||||
status: 'failure',
|
||||
lastRunAt: new Date()
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
@ -151,7 +151,7 @@ export async function updateFinancials(
|
|||
* Schedule financial updates for symbols that need refreshing
|
||||
*/
|
||||
export async function scheduleFinancialsUpdates(
|
||||
this: BaseHandler,
|
||||
this: QMHandler,
|
||||
input: {
|
||||
limit?: number;
|
||||
forceUpdate?: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue