Fix: Correct all database model names from camelCase to snake_case

- Fixed ai-analytics API: Created missing endpoint and corrected model names
- Fixed ai-learning-status.ts: Updated to use ai_learning_data and trades models
- Fixed batch-analysis route: Corrected ai_learning_data model references
- Fixed analysis-details route: Updated automation_sessions and trades models
- Fixed test scripts: Updated model names in check-learning-data.js and others
- Disabled conflicting route files to prevent Next.js confusion

All APIs now use correct snake_case model names matching Prisma schema:
- ai_learning_data (not aILearningData)
- automation_sessions (not automationSession)
- trades (not trade)

This resolves 'Unable to load REAL AI analytics' frontend errors.
This commit is contained in:
mindesbunister
2025-07-26 10:53:56 +02:00
parent e3eff629a3
commit f263cac55f
9 changed files with 146 additions and 260 deletions

View File

@@ -21,7 +21,7 @@ async function storeAnalysisForLearning(symbol, analysis) {
timestamp: new Date().toISOString()
}
await prisma.aILearningData.create({
await prisma.ai_learning_data.create({
data: {
userId: 'default-user', // Use same default user as ai-learning-status
symbol: symbol,
@@ -198,9 +198,7 @@ export async function POST(request) {
try {
if (allScreenshots.length === 1) {
// Use enhanced AI analysis with symbol and primary timeframe for learning
const primaryTimeframe = timeframes[0] || '1h';
analysis = await aiAnalysisService.analyzeScreenshot(allScreenshots[0], symbol, primaryTimeframe)
analysis = await aiAnalysisService.analyzeScreenshot(allScreenshots[0])
} else {
analysis = await aiAnalysisService.analyzeMultipleScreenshots(allScreenshots)
}