learning_ai_invt_trdg/backend/diagnose_profiles.ts

27 lines
1.1 KiB
TypeScript

import { supabaseService } from '../src/services/SupabaseService.js';
import logger from '../src/utils/logger.js';
async function checkProfiles() {
console.log('--- 🛡️ PROFILE DIAGNOSTIC ---');
const profiles = await supabaseService.getActiveProfiles();
if (profiles.length === 0) {
console.log('❌ NO ACTIVE PROFILES FOUND.');
const users = await supabaseService.getActiveUsers();
console.log(`Note: ${users.length} users have trade_enable=true, but no active profiles linked to them.`);
} else {
console.log(`✅ FOUND ${profiles.length} ACTIVE PROFILES:`);
profiles.forEach(p => {
console.log(`- Profile: ${p.name} (ID: ${p.id})`);
console.log(` User: ${p.users?.email} (ID: ${p.user_id})`);
console.log(` Symbols: ${p.symbols || 'ALL'}`);
console.log(` Capital: $${p.allocated_capital} | Risk: ${p.risk_per_trade_percent}%`);
console.log(` Global Trade Enable: ${p.users?.trade_enable}`);
console.log('---');
});
}
}
checkProfiles();