Fix automation startup issue and add AI learning documentation

- Fixed foreign key constraint violation in automation service
- Added user upsert to ensure user exists before creating automation session
- Enhanced error reporting in automation start API
- Added comprehensive AI learning system documentation
- Automation now starts successfully in simulation mode
This commit is contained in:
mindesbunister
2025-07-18 20:18:38 +02:00
parent 892c2c845f
commit 118e0269f1
4 changed files with 373 additions and 1 deletions

View File

@@ -58,6 +58,19 @@ export class AutomationService {
console.log(`🤖 Starting automation for ${config.symbol} ${config.timeframe} in ${config.mode} mode`)
// Ensure user exists in database
await prisma.user.upsert({
where: { id: config.userId },
update: {},
create: {
id: config.userId,
email: `${config.userId}@example.com`,
name: config.userId,
createdAt: new Date(),
updatedAt: new Date()
}
})
// Create automation session in database
await prisma.automationSession.create({
data: {