Commit Graph

11 Commits

Author SHA1 Message Date
Adrian Flores Cortes
0563d4bc9b fix(coherence): Align education types with DDL (E-COH-005, ST1.5)
- Updated src/modules/education/types/education.types.ts with DDL alignment
- Added all missing enums: DifficultyLevel, CourseStatus, LessonContentType, etc.
- Added AchievementType enum (course_completion, quiz_perfect_score, etc.)
- Updated Course interface to match DDL fields exactly
- Updated Module interface (displayOrder, xpReward)
- Updated Lesson interface (LessonContentType, attachments, displayOrder)
- Updated Enrollment interface (completedLessons, totalLessons, totalXpEarned)
- Updated LessonProgress interface (isCompleted, videoProgressSeconds, xpEarned)
- Updated Quiz interface (passingScorePercentage, xpReward, xpPerfectScoreBonus)
- Updated QuizQuestion interface (displayOrder)
- Updated QuizAttempt interface (scorePoints, maxPoints, scorePercentage, xpEarned)
- Added new interfaces: Certificate, UserAchievement, UserGamificationProfile, UserActivityLog
- Added LessonAttachment interface for JSONB attachments field
- Deprecated old type aliases for backward compatibility

All types now fully aligned with education.* DDL schema.
Note: Services will need migration in separate task (breaking changes documented).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:02:18 -06:00
Adrian Flores Cortes
d73253130f fix(coherence): Add all trading enums aligned with DDL (E-COH-002, ST1.4)
- Extended src/modules/trading/types/order.types.ts with all DDL enums
- Added OrderType with trailing_stop support
- Added PositionStatus (open, closed, liquidated)
- Added SignalType (entry_long, entry_short, exit_long, exit_short, hold)
- Added ConfidenceLevel (low, medium, high, very_high)
- Added Timeframe (1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M)
- Added BotType (paper, live, backtest)
- Added BotStatus (active, paused, stopped, error)

All types now aligned with trading.* enums from DDL schema.
Provides comprehensive type definitions for trading module.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:07:09 -06:00
Adrian Flores Cortes
1be94f0c1f fix(coherence): Create centralized portfolio types (E-COH-004, ST1.3)
- Created apps/backend/src/modules/portfolio/types/portfolio.types.ts
- Consolidated all portfolio type definitions from DDL
- Updated repositories to import from centralized types
- Updated service to use centralized types (removed duplicates)
- Updated controller to import RiskProfile from types
- Removed 73 lines of duplicate type definitions

Fixes coherence gap E-COH-004 where portfolio types were absent in backend.
All types now align with DDL schema (portfolio.* enums and tables).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:02:04 -06:00
Adrian Flores Cortes
3bb215b51b fix(coherence): Align backend types with DDL (E-COH-001, E-COH-003)
COHERENCIA FIXES P0 (ST1.1 + ST1.2 - 45min total)

ST1.1 (E-COH-001 - 15min):
- Fixed backend UserRole enum to match DDL
- Changed: investor→user, removed student/instructor, added analyst
- Deprecated requireInstructor guard (role doesn't exist in DDL)

ST1.2 (E-COH-003 - 30min):
- Created investment.types.ts with all enums from DDL
- Centralized types: TradingAgent, RiskProfile, AccountStatus,
  DistributionFrequency, TransactionType, TransactionStatus
- Updated all imports in repositories, services, controllers

Impact:
- Type safety across auth and investment modules
- Coherence with DDL (source of truth) guaranteed
- Eliminated type duplication and inconsistencies

Modified files:
- src/modules/auth/types/auth.types.ts
- src/core/guards/auth.guard.ts
- src/modules/investment/types/investment.types.ts (NEW)
- src/modules/investment/repositories/account.repository.ts
- src/modules/investment/services/account.service.ts
- src/modules/investment/services/product.service.ts
- src/modules/investment/controllers/investment.controller.ts

Task: TASK-2026-01-26-ANALYSIS-INTEGRATION-PLAN
Subtasks: ST1.1, ST1.2
Epics: OQI-001, OQI-004
Priority: P0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 16:48:44 -06:00
Adrian Flores Cortes
b0bfbe19ad [OQI-008] feat: Initialize portfolio WebSocket service in server
- Import and initialize portfolioWebSocket in index.ts
- Add graceful shutdown for portfolioWebSocket
- Enable real-time portfolio updates via WebSocket

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:49:27 -06:00
Adrian Flores Cortes
32a088698e [OQI-008] feat: Add portfolio Phase 3 - WebSocket, snapshots, performance APIs
- Add portfolio.websocket.ts for real-time portfolio updates
- Add snapshot.repository.ts for historical performance data
- Add getPortfolioPerformance and getPerformanceStats endpoints
- Update routes with /performance and /performance/stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:40:22 -06:00
Adrian Flores Cortes
f40dfa8061 [OQI-008] feat: Add PostgreSQL repositories for portfolio module
- Created portfolio.repository.ts with CRUD operations for portfolios and allocations
- Created goal.repository.ts with CRUD operations for portfolio goals
- Updated portfolio.service.ts to use repositories with in-memory fallback
- Migrated createPortfolio, getPortfolio, getUserPortfolios methods
- Migrated updateAllocations, executeRebalance methods
- Migrated createGoal, getUserGoals, updateGoalProgress, deleteGoal methods
- Added helper functions for mapping between repo and service types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:21:08 -06:00
Adrian Flores Cortes
4322caf69a [OQI-004] feat: Complete PostgreSQL migration for investment module
- withdrawal.repository.ts: CRUD for withdrawal_requests table
- distribution.repository.ts: CRUD for profit_distributions table
- product.repository.ts: CRUD for products table with DB/in-memory fallback
- transaction.service.ts: Migrated withdrawal and distribution to repositories
- product.service.ts: Added DB support with in-memory defaults fallback

All investment entities now persist to PostgreSQL instead of in-memory storage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:57:18 -06:00
Adrian Flores Cortes
3df1ed1f94 [OQI-004] feat: Migrate investment services to PostgreSQL repositories
- account.service.ts: Now uses accountRepository instead of in-memory Map
- transaction.service.ts: Now uses transactionRepository for transactions
- Added account.repository.ts with full CRUD and balance operations
- Added transaction.repository.ts with query, create, and update operations
- Withdrawal and distribution entities still use in-memory storage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:44:07 -06:00
Adrian Flores Cortes
35a94f0529 feat: Complete notifications system with push support and tests
- Add Firebase client for FCM push notifications
- Update notification service with push token management
- Add push token registration/removal endpoints
- Update all queries to use auth schema
- Add comprehensive unit tests for notification.service
- Add unit tests for distribution.job

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:56:34 -06:00
e45591a0ef feat: Initial commit - Trading Platform Backend
NestJS backend with:
- Authentication (JWT)
- WebSocket real-time support
- ML integration services
- Payments module
- User management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 04:28:47 -06:00