fixed some lint issues

This commit is contained in:
Boki 2025-06-23 22:58:42 -04:00
parent 566f5dac92
commit 969cbad7ac
14 changed files with 99 additions and 29 deletions

View file

@ -32,9 +32,23 @@ export async function updateCeoChannels(
const totalChannels = results.channel_categories[0].total_channels;
const totalPages = Math.ceil(totalChannels / channels.length);
const exchanges: { exchange: string; countryCode: string }[] = [];
const symbols = channels.map((channel: any) => {
interface Channel {
symbol: string;
exchange: string;
title: string;
type: string;
channel: string;
spiel_count: number;
unread_count: number;
is_following: boolean;
last_viewed_timestamp: string;
last_timestamp: string;
company_details?: Record<string, unknown>;
}
const symbols = channels.map((channel: Channel) => {
// check if exchange is in the exchanges array object
if (!exchanges.find((e: any) => e.exchange === channel.exchange)) {
if (!exchanges.find((e) => e.exchange === channel.exchange)) {
exchanges.push({
exchange: channel.exchange,
countryCode: 'CA',

View file

@ -3,7 +3,7 @@ import type { CeoHandler } from '../ceo.handler';
export async function updateUniqueSymbols(
this: CeoHandler,
_payload: unknown,
_context: any
_context: unknown
): Promise<unknown> {
this.logger.info('Starting update to get unique CEO symbols by ceoId');

View file

@ -47,7 +47,7 @@ export async function initializeAllHandlers(serviceContainer: IServiceContainer)
/**
* Manual fallback registration
*/
async function manualHandlerRegistration(_serviceContainer: any): Promise<void> {
async function manualHandlerRegistration(_serviceContainer: IServiceContainer): Promise<void> {
logger.warn('Falling back to manual handler registration');
try {

View file

@ -4,16 +4,25 @@
import type { IServiceContainer } from '@stock-bot/handlers';
export async function fetchExchanges(services: IServiceContainer): Promise<any[]> {
interface QMExchange {
_id?: string;
code: string;
name: string;
country: string;
currency: string;
timezone?: string;
}
export async function fetchExchanges(services: IServiceContainer): Promise<QMExchange[]> {
// Get exchanges from MongoDB
const exchanges = await services.mongodb.collection('qm_exchanges').find({}).toArray();
const exchanges = await services.mongodb.collection<QMExchange>('qm_exchanges').find({}).toArray();
return exchanges;
}
export async function getExchangeByCode(services: IServiceContainer, code: string): Promise<any> {
export async function getExchangeByCode(services: IServiceContainer, code: string): Promise<QMExchange | null> {
// Get specific exchange by code
const exchange = await services.mongodb.collection('qm_exchanges').findOne({ code });
const exchange = await services.mongodb.collection<QMExchange>('qm_exchanges').findOne({ code });
return exchange;
}

View file

@ -41,9 +41,14 @@ export async function checkSessions(handler: BaseHandler): Promise<{
/**
* Create a single session for a specific session ID
*/
interface CreateSessionInput {
sessionId?: string;
sessionType?: string;
}
export async function createSingleSession(
handler: BaseHandler,
input: any
input: CreateSessionInput
): Promise<{ sessionId: string; status: string; sessionType: string }> {
const { sessionId: _sessionId, sessionType } = input || {};
const _sessionManager = QMSessionManager.getInstance();

View file

@ -4,16 +4,26 @@
import type { IServiceContainer } from '@stock-bot/handlers';
export async function searchSymbols(services: IServiceContainer): Promise<any[]> {
interface QMSymbol {
_id?: string;
symbol: string;
name: string;
exchange: string;
type?: string;
sector?: string;
industry?: string;
}
export async function searchSymbols(services: IServiceContainer): Promise<QMSymbol[]> {
// Get symbols from MongoDB
const symbols = await services.mongodb.collection('qm_symbols').find({}).limit(50).toArray();
const symbols = await services.mongodb.collection<QMSymbol>('qm_symbols').find({}).limit(50).toArray();
return symbols;
}
export async function fetchSymbolData(services: IServiceContainer, symbol: string): Promise<any> {
export async function fetchSymbolData(services: IServiceContainer, symbol: string): Promise<QMSymbol | null> {
// Fetch data for a specific symbol
const symbolData = await services.mongodb.collection('qm_symbols').findOne({ symbol });
const symbolData = await services.mongodb.collection<QMSymbol>('qm_symbols').findOne({ symbol });
return symbolData;
}

View file

@ -3,7 +3,7 @@
* Simplified entry point using ServiceApplication framework
*/
import { initializeStockConfig } from '@stock-bot/stock-config';
import { initializeStockConfig, type StockAppConfig } from '@stock-bot/stock-config';
import {
ServiceApplication,
} from '@stock-bot/di';
@ -52,7 +52,7 @@ const app = new ServiceApplication(
);
// Container factory function
async function createContainer(config: any) {
async function createContainer(config: StockAppConfig) {
const { ServiceContainerBuilder } = await import('@stock-bot/di');
const container = await new ServiceContainerBuilder()