feat: 初始化并配置了 Gin API 路由器,包括所有仓库、服务和处理程序。
This commit is contained in:
@@ -332,15 +332,18 @@ func SetupWithRedis(db *gorm.DB, yunAPIClient *service.YunAPIClient, redisClient
|
|||||||
notificationRepo := repository.NewNotificationRepository(db)
|
notificationRepo := repository.NewNotificationRepository(db)
|
||||||
streakRepo := repository.NewStreakRepository(db)
|
streakRepo := repository.NewStreakRepository(db)
|
||||||
|
|
||||||
|
// Initialize services (Stage 1: Core Services needed for Auth)
|
||||||
|
ledgerService := service.NewLedgerService(ledgerRepo, db)
|
||||||
|
|
||||||
// Initialize auth services
|
// Initialize auth services
|
||||||
authService := service.NewAuthService(userRepo, cfg)
|
authService := service.NewAuthService(userRepo, ledgerService, cfg)
|
||||||
var gitHubOAuthService *service.GitHubOAuthService
|
var gitHubOAuthService *service.GitHubOAuthService
|
||||||
if cfg.GitHubClientID != "" && cfg.GitHubClientSecret != "" {
|
if cfg.GitHubClientID != "" && cfg.GitHubClientSecret != "" {
|
||||||
gitHubOAuthService = service.NewGitHubOAuthService(userRepo, authService, cfg)
|
gitHubOAuthService = service.NewGitHubOAuthService(userRepo, authService, ledgerService, cfg)
|
||||||
}
|
}
|
||||||
var giteeOAuthService *service.GiteeOAuthService
|
var giteeOAuthService *service.GiteeOAuthService
|
||||||
if cfg.GiteeClientID != "" && cfg.GiteeClientSecret != "" {
|
if cfg.GiteeClientID != "" && cfg.GiteeClientSecret != "" {
|
||||||
giteeOAuthService = service.NewGiteeOAuthService(userRepo, authService, cfg)
|
giteeOAuthService = service.NewGiteeOAuthService(userRepo, authService, ledgerService, cfg)
|
||||||
}
|
}
|
||||||
authHandler := handler.NewAuthHandlerWithConfig(authService, gitHubOAuthService, giteeOAuthService, cfg)
|
authHandler := handler.NewAuthHandlerWithConfig(authService, gitHubOAuthService, giteeOAuthService, cfg)
|
||||||
authMiddleware := middleware.NewAuthMiddleware(authService)
|
authMiddleware := middleware.NewAuthMiddleware(authService)
|
||||||
@@ -364,7 +367,7 @@ func SetupWithRedis(db *gorm.DB, yunAPIClient *service.YunAPIClient, redisClient
|
|||||||
repaymentService := service.NewRepaymentService(repaymentRepo, billingRepo, accountRepo, db)
|
repaymentService := service.NewRepaymentService(repaymentRepo, billingRepo, accountRepo, db)
|
||||||
backupService := service.NewBackupService(db)
|
backupService := service.NewBackupService(db)
|
||||||
appLockService := service.NewAppLockService(appLockRepo)
|
appLockService := service.NewAppLockService(appLockRepo)
|
||||||
ledgerService := service.NewLedgerService(ledgerRepo, db)
|
// ledgerService initialized earlier
|
||||||
reimbursementService := service.NewReimbursementService(db, transactionRepo, accountRepo)
|
reimbursementService := service.NewReimbursementService(db, transactionRepo, accountRepo)
|
||||||
refundService := service.NewRefundService(db, transactionRepo, accountRepo)
|
refundService := service.NewRefundService(db, transactionRepo, accountRepo)
|
||||||
userSettingsService := service.NewUserSettingsService(userSettingsRepo)
|
userSettingsService := service.NewUserSettingsService(userSettingsRepo)
|
||||||
|
|||||||
Reference in New Issue
Block a user