Skip to content

fix: resolve MongoDB dependency injection errors + add admin features#18

Open
RyaninKR wants to merge 3 commits intodevfrom
feat/admin
Open

fix: resolve MongoDB dependency injection errors + add admin features#18
RyaninKR wants to merge 3 commits intodevfrom
feat/admin

Conversation

@RyaninKR
Copy link
Member

@RyaninKR RyaninKR commented Sep 13, 2025

Summary

  • Add party mapping utilities to ClaudeJurySynthesisService for consistent party identification
  • Fix fallback synthesis formatting and variable references
  • Add admin controller and routes for user management
  • Add activity logging system for audit trails
  • Fix MongoDB dependency injection errors for Railway deployment
  • Resolve "mongoClient.db is not a function" error in admin repositories
  • Clean up Python cache files and improve gitignore

Recent Critical Fixes (Latest Commit)

MongoDB Deployment Issues Resolved

  • Fixed "No matching bindings found for serviceIdentifier: MongoDBConnection" - Changed all repositories to use TYPES.MongoDBConnection instead of string literals
  • Fixed "mongoClient.db is not a function" - Updated admin repositories to accept Db instead of MongoClient
  • Removed duplicate MongoDB shutdown callback in index.ts
  • Fixed 7 repository files total: User, Contract, OracleDecision, WinnerArgumentsCache, ActivityLog, Post, Comment

Infrastructure Improvements

  • Added admin-frontend to gitignore
  • Cleaned up Python cache files
  • Improved CORS configuration with debug logging

Technical Changes

Core Repository Fixes

  • MongoUserRepository.ts: Use TYPES.MongoDBConnection for dependency injection
  • MongoContractRepository.ts: Use TYPES.MongoDBConnection for dependency injection
  • MongoOracleDecisionRepository.ts: Use TYPES.MongoDBConnection for dependency injection
  • MongoWinnerArgumentsCache.ts: Use TYPES.MongoDBConnection for dependency injection
  • MongoActivityLogRepository.ts: Use TYPES.MongoDBConnection for dependency injection

Admin Repository Fixes

  • MongoPostRepository.ts: Accept Db instead of MongoClient, remove .db() call
  • MongoCommentRepository.ts: Accept Db instead of MongoClient, remove .db() call

Container & Index Updates

  • container.ts: Use TYPES symbols throughout for consistency
  • index.ts: Fix MongoDB connection binding and remove duplicate shutdown callback

Test Plan

  • Build succeeds without TypeScript errors
  • Application starts successfully with MongoDB disabled (local dev)
  • Application properly attempts MongoDB connection when enabled (production)
  • No more dependency injection binding errors
  • Ready for Railway deployment
  • Test party mapping functions with various partyId formats
  • Verify admin endpoints work correctly
  • Check activity logging is properly recorded
  • Ensure AI synthesis still works with the changes

Impact

This PR now includes critical deployment fixes that resolve MongoDB binding errors preventing successful Railway deployment. The application can now start properly in both development and production environments.

…atting

- Add toPartyLabel method to map partyId to logical labels (partyA/partyB)
- Add toPartyDisplayName method for consistent party name display
- Fix fallback synthesis argument generation and variable references
- Make driver property mutable for runtime configuration
- Remove Python virtual environment from git tracking
- Add .venv patterns to .gitignore
- Fix User entity with missing properties (email, active, apiKeys, updatedAt)
- Add ApiKey interface with required properties
- Fix AppError class with missing static methods (internal, badRequest)
- Add missing exports to rateLimitMiddleware (adminRateLimiter, xffBypassMiddleware)
- Add count() methods to repository interfaces and implementations
- Fix GeminiJuror return statement in error case
- Update User methods to support optional parameters
- Fix constructor parameter order in repository implementations

All 47+ TypeScript errors resolved for successful deployment.
- Fix MongoDBConnection string literal to use TYPES symbol in all repositories
- Fix admin repositories to accept Db instead of MongoClient
- Remove duplicate MongoDB shutdown callback
- Clean up Python cache files and add admin-frontend to gitignore

This resolves the "No matching bindings found for serviceIdentifier: MongoDBConnection"
and "mongoClient.db is not a function" errors preventing successful deployment.
@RyaninKR RyaninKR changed the title feat(ai): add party mapping utilities and admin features fix: resolve MongoDB dependency injection errors + add admin features Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant