21 lines
No EOL
769 B
TypeScript
21 lines
No EOL
769 B
TypeScript
import { getLogger } from '@stock-bot/logger';
|
|
import { getPostgreSQLClient } from '@stock-bot/postgres-client';
|
|
import type { JobPayload } from '../../../types/job-payloads';
|
|
|
|
const logger = getLogger('sync-status');
|
|
|
|
export async function getSyncStatus(payload: JobPayload): Promise<Record<string, unknown>[]> {
|
|
logger.info('Getting sync status...');
|
|
|
|
try {
|
|
const postgresClient = getPostgreSQLClient();
|
|
const query = 'SELECT * FROM sync_status ORDER BY provider, data_type';
|
|
const result = await postgresClient.query(query);
|
|
|
|
logger.info(`Retrieved sync status for ${result.rows.length} entries`);
|
|
return result.rows;
|
|
} catch (error) {
|
|
logger.error('Failed to get sync status', { error });
|
|
throw error;
|
|
}
|
|
} |