running prettier for cleanup

This commit is contained in:
Boki 2025-06-11 10:13:25 -04:00
parent fe7733aeb5
commit d85cd58acd
151 changed files with 29158 additions and 27966 deletions

View file

@ -7,14 +7,14 @@ import { queueManager } from '../services/queue.service';
export const healthRoutes = new Hono();
// Health check endpoint
healthRoutes.get('/health', (c) => {
return c.json({
service: 'data-service',
healthRoutes.get('/health', c => {
return c.json({
service: 'data-service',
status: 'healthy',
timestamp: new Date().toISOString(),
queue: {
status: 'running',
workers: queueManager.getWorkerCount()
}
workers: queueManager.getWorkerCount(),
},
});
});

View file

@ -10,10 +10,10 @@ const logger = getLogger('market-data-routes');
export const marketDataRoutes = new Hono();
// Market data endpoints
marketDataRoutes.get('/api/live/:symbol', async (c) => {
marketDataRoutes.get('/api/live/:symbol', async c => {
const symbol = c.req.param('symbol');
logger.info('Live data request', { symbol });
try {
// Queue job for live data using Yahoo provider
const job = await queueManager.addJob({
@ -21,13 +21,13 @@ marketDataRoutes.get('/api/live/:symbol', async (c) => {
service: 'market-data',
provider: 'yahoo-finance',
operation: 'live-data',
payload: { symbol }
payload: { symbol },
});
return c.json({
status: 'success',
return c.json({
status: 'success',
message: 'Live data job queued',
jobId: job.id,
symbol
symbol,
});
} catch (error) {
logger.error('Failed to queue live data job', { symbol, error });
@ -35,37 +35,37 @@ marketDataRoutes.get('/api/live/:symbol', async (c) => {
}
});
marketDataRoutes.get('/api/historical/:symbol', async (c) => {
marketDataRoutes.get('/api/historical/:symbol', async c => {
const symbol = c.req.param('symbol');
const from = c.req.query('from');
const to = c.req.query('to');
logger.info('Historical data request', { symbol, from, to });
try {
const fromDate = from ? new Date(from) : new Date(Date.now() - 30 * 24 * 60 * 60 * 1000); // 30 days ago
const toDate = to ? new Date(to) : new Date(); // Now
// Queue job for historical data using Yahoo provider
const job = await queueManager.addJob({
type: 'market-data-historical',
service: 'market-data',
provider: 'yahoo-finance',
operation: 'historical-data',
payload: {
symbol,
from: fromDate.toISOString(),
to: toDate.toISOString()
}
payload: {
symbol,
from: fromDate.toISOString(),
to: toDate.toISOString(),
},
});
return c.json({
status: 'success',
return c.json({
status: 'success',
message: 'Historical data job queued',
jobId: job.id,
symbol,
from: fromDate,
to: toDate
symbol,
from: fromDate,
to: toDate,
});
} catch (error) {
logger.error('Failed to queue historical data job', { symbol, from, to, error });

View file

@ -10,20 +10,20 @@ const logger = getLogger('proxy-routes');
export const proxyRoutes = new Hono();
// Proxy management endpoints
proxyRoutes.post('/api/proxy/fetch', async (c) => {
proxyRoutes.post('/api/proxy/fetch', async c => {
try {
const job = await queueManager.addJob({
type: 'proxy-fetch',
provider: 'proxy-provider',
operation: 'fetch-and-check',
payload: {},
priority: 5
priority: 5,
});
return c.json({
status: 'success',
jobId: job.id,
message: 'Proxy fetch job queued'
return c.json({
status: 'success',
jobId: job.id,
message: 'Proxy fetch job queued',
});
} catch (error) {
logger.error('Failed to queue proxy fetch', { error });
@ -31,7 +31,7 @@ proxyRoutes.post('/api/proxy/fetch', async (c) => {
}
});
proxyRoutes.post('/api/proxy/check', async (c) => {
proxyRoutes.post('/api/proxy/check', async c => {
try {
const { proxies } = await c.req.json();
const job = await queueManager.addJob({
@ -39,13 +39,13 @@ proxyRoutes.post('/api/proxy/check', async (c) => {
provider: 'proxy-provider',
operation: 'check-specific',
payload: { proxies },
priority: 8
priority: 8,
});
return c.json({
status: 'success',
jobId: job.id,
message: `Proxy check job queued for ${proxies.length} proxies`
return c.json({
status: 'success',
jobId: job.id,
message: `Proxy check job queued for ${proxies.length} proxies`,
});
} catch (error) {
logger.error('Failed to queue proxy check', { error });
@ -54,20 +54,20 @@ proxyRoutes.post('/api/proxy/check', async (c) => {
});
// Get proxy stats via queue
proxyRoutes.get('/api/proxy/stats', async (c) => {
proxyRoutes.get('/api/proxy/stats', async c => {
try {
const job = await queueManager.addJob({
type: 'proxy-stats',
provider: 'proxy-provider',
operation: 'get-stats',
payload: {},
priority: 3
priority: 3,
});
return c.json({
status: 'success',
jobId: job.id,
message: 'Proxy stats job queued'
return c.json({
status: 'success',
jobId: job.id,
message: 'Proxy stats job queued',
});
} catch (error) {
logger.error('Failed to queue proxy stats', { error });

View file

@ -10,7 +10,7 @@ const logger = getLogger('queue-routes');
export const queueRoutes = new Hono();
// Queue management endpoints
queueRoutes.get('/api/queue/status', async (c) => {
queueRoutes.get('/api/queue/status', async c => {
try {
const status = await queueManager.getQueueStatus();
return c.json({ status: 'success', data: status });
@ -20,7 +20,7 @@ queueRoutes.get('/api/queue/status', async (c) => {
}
});
queueRoutes.post('/api/queue/job', async (c) => {
queueRoutes.post('/api/queue/job', async c => {
try {
const jobData = await c.req.json();
const job = await queueManager.addJob(jobData);
@ -32,7 +32,7 @@ queueRoutes.post('/api/queue/job', async (c) => {
});
// Provider registry endpoints
queueRoutes.get('/api/providers', async (c) => {
queueRoutes.get('/api/providers', async c => {
try {
const { providerRegistry } = await import('../services/provider-registry.service');
const providers = providerRegistry.getProviders();
@ -44,14 +44,14 @@ queueRoutes.get('/api/providers', async (c) => {
});
// Add new endpoint to see scheduled jobs
queueRoutes.get('/api/scheduled-jobs', async (c) => {
queueRoutes.get('/api/scheduled-jobs', async c => {
try {
const { providerRegistry } = await import('../services/provider-registry.service');
const jobs = providerRegistry.getAllScheduledJobs();
return c.json({
status: 'success',
return c.json({
status: 'success',
count: jobs.length,
jobs
jobs,
});
} catch (error) {
logger.error('Failed to get scheduled jobs info', { error });
@ -59,7 +59,7 @@ queueRoutes.get('/api/scheduled-jobs', async (c) => {
}
});
queueRoutes.post('/api/queue/drain', async (c) => {
queueRoutes.post('/api/queue/drain', async c => {
try {
await queueManager.drainQueue();
const status = await queueManager.getQueueStatus();

View file

@ -10,21 +10,21 @@ const logger = getLogger('test-routes');
export const testRoutes = new Hono();
// Test endpoint for new functional batch processing
testRoutes.post('/api/test/batch-symbols', async (c) => {
testRoutes.post('/api/test/batch-symbols', async c => {
try {
const { symbols, useBatching = false, totalDelayHours = 1 } = await c.req.json();
const { processItems } = await import('../utils/batch-helpers');
if (!symbols || !Array.isArray(symbols)) {
return c.json({ status: 'error', message: 'symbols array is required' }, 400);
}
const result = await processItems(
symbols,
(symbol, index) => ({
symbol,
(symbol, index) => ({
symbol,
index,
timestamp: new Date().toISOString()
timestamp: new Date().toISOString(),
}),
queueManager,
{
@ -33,14 +33,14 @@ testRoutes.post('/api/test/batch-symbols', async (c) => {
batchSize: 10,
priority: 1,
provider: 'test-provider',
operation: 'live-data'
operation: 'live-data',
}
);
return c.json({
status: 'success',
return c.json({
status: 'success',
message: 'Batch processing started',
result
result,
});
} catch (error) {
logger.error('Failed to start batch symbol processing', { error });
@ -48,21 +48,21 @@ testRoutes.post('/api/test/batch-symbols', async (c) => {
}
});
testRoutes.post('/api/test/batch-custom', async (c) => {
testRoutes.post('/api/test/batch-custom', async c => {
try {
const { items, useBatching = false, totalDelayHours = 0.5 } = await c.req.json();
const { processItems } = await import('../utils/batch-helpers');
if (!items || !Array.isArray(items)) {
return c.json({ status: 'error', message: 'items array is required' }, 400);
}
const result = await processItems(
items,
(item, index) => ({
originalItem: item,
(item, index) => ({
originalItem: item,
processIndex: index,
timestamp: new Date().toISOString()
timestamp: new Date().toISOString(),
}),
queueManager,
{
@ -71,14 +71,14 @@ testRoutes.post('/api/test/batch-custom', async (c) => {
batchSize: 5,
priority: 1,
provider: 'test-provider',
operation: 'custom-test'
operation: 'custom-test',
}
);
return c.json({
status: 'success',
return c.json({
status: 'success',
message: 'Custom batch processing started',
result
result,
});
} catch (error) {
logger.error('Failed to start custom batch processing', { error });