27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { supabaseService } from '../src/services/SupabaseService.js';
|
|
import logger from '../src/utils/logger.js';
|
|
|
|
async function testFetch() {
|
|
logger.info('--- Testing Data Retrieval ---');
|
|
const userId = '88a2446e-740f-4c87-a94c-fad0ee5167ba';
|
|
|
|
// 1. Check Orders
|
|
// We don't have a public method to fetch ALL orders in SupabaseService, so let's use the internal client if possible
|
|
// or just assume if we can log we can read.
|
|
// Actually SupabaseService has `getLatestOrder`.
|
|
|
|
logger.info(`Fetching latest order for ${userId} (BTC/USDT)...`);
|
|
const order = await supabaseService.getLatestOrder(userId, 'BTC/USDT');
|
|
|
|
if (order) {
|
|
logger.info('✅ FOUND ORDER in DB:', order);
|
|
} else {
|
|
logger.error('❌ NO ORDER FOUND in DB for this user/symbol.');
|
|
}
|
|
|
|
// 2. We can't easily fetch trade_history via the service wrapper as it doesn't expose a getter for history.
|
|
// But if orders exist, history likely does too.
|
|
}
|
|
|
|
testFetch().catch(console.error);
|