fixed some lint issues
This commit is contained in:
parent
566f5dac92
commit
969cbad7ac
14 changed files with 99 additions and 29 deletions
|
|
@ -4,10 +4,17 @@ import type { JobPayload } from '../../../types/job-payloads';
|
|||
|
||||
const logger = getLogger('enhanced-sync-exchange-stats');
|
||||
|
||||
interface ExchangeStats {
|
||||
total_exchanges: string;
|
||||
active_exchanges: string;
|
||||
countries: string;
|
||||
currencies: string;
|
||||
}
|
||||
|
||||
export async function getExchangeStats(
|
||||
payload: JobPayload,
|
||||
container: IServiceContainer
|
||||
): Promise<any> {
|
||||
): Promise<ExchangeStats> {
|
||||
logger.info('Getting exchange statistics...');
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,19 @@ import type { JobPayload } from '../../../types/job-payloads';
|
|||
|
||||
const logger = getLogger('enhanced-sync-provider-mapping-stats');
|
||||
|
||||
interface ProviderMappingStats {
|
||||
provider: string;
|
||||
total_mappings: string;
|
||||
active_mappings: string;
|
||||
verified_mappings: string;
|
||||
auto_mapped: string;
|
||||
avg_confidence: string;
|
||||
}
|
||||
|
||||
export async function getProviderMappingStats(
|
||||
payload: JobPayload,
|
||||
container: IServiceContainer
|
||||
): Promise<any> {
|
||||
): Promise<ProviderMappingStats[]> {
|
||||
logger.info('Getting provider mapping statistics...');
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -53,13 +53,30 @@ export async function syncQMExchanges(
|
|||
}
|
||||
|
||||
// Helper functions
|
||||
async function findExchange(exchangeCode: string, postgresClient: any): Promise<any> {
|
||||
interface Exchange {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
country: string;
|
||||
currency: string;
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
async function findExchange(exchangeCode: string, postgresClient: IServiceContainer['postgres']): Promise<Exchange | null> {
|
||||
const query = 'SELECT * FROM exchanges WHERE code = $1';
|
||||
const result = await postgresClient.query(query, [exchangeCode]);
|
||||
return result.rows[0] || null;
|
||||
}
|
||||
|
||||
async function createExchange(qmExchange: any, postgresClient: any): Promise<void> {
|
||||
interface QMExchange {
|
||||
exchangeCode?: string;
|
||||
exchange?: string;
|
||||
exchangeShortName?: string;
|
||||
name?: string;
|
||||
countryCode?: string;
|
||||
}
|
||||
|
||||
async function createExchange(qmExchange: QMExchange, postgresClient: IServiceContainer['postgres']): Promise<void> {
|
||||
const query = `
|
||||
INSERT INTO exchanges (code, name, country, currency, visible)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
|
|
@ -77,8 +94,8 @@ async function createExchange(qmExchange: any, postgresClient: any): Promise<voi
|
|||
|
||||
async function updateExchange(
|
||||
exchangeId: string,
|
||||
qmExchange: any,
|
||||
postgresClient: any
|
||||
qmExchange: QMExchange,
|
||||
postgresClient: IServiceContainer['postgres']
|
||||
): Promise<void> {
|
||||
const query = `
|
||||
UPDATE exchanges
|
||||
|
|
@ -99,7 +116,7 @@ async function updateSyncStatus(
|
|||
provider: string,
|
||||
dataType: string,
|
||||
count: number,
|
||||
postgresClient: any
|
||||
postgresClient: IServiceContainer['postgres']
|
||||
): Promise<void> {
|
||||
const query = `
|
||||
UPDATE sync_status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue