refactor: update WebSocket handler initialization in wire generation
Some checks failed
Build Backend / build-docker (push) Has been cancelled
Build Backend / build (push) Has been cancelled

- Replaced direct WSHandler instantiation with a dependency injection approach using ProvideWSHandler.
- Improved code organization and maintainability by aligning with the updated dependency injection patterns.
This commit is contained in:
lafay
2026-03-26 21:38:51 +08:00
parent 6d335e393d
commit 359e624e7c

View File

@@ -115,11 +115,11 @@ func InitializeApp() (*App, error) {
adminLogHandler := handler.NewAdminLogHandler(operationLogService, loginLogService, dataChangeLogService)
qrCodeLoginService := wire.ProvideQRCodeLoginService(client, hub, jwtService, userService, userActivityService, logService)
qrCodeHandler := handler.NewQRCodeHandler(qrCodeLoginService)
wsHandler := handler.NewWSHandler(hub, chatService, groupService, jwtService)
materialSubjectRepository := repository.NewMaterialSubjectRepository(db)
materialFileRepository := repository.NewMaterialFileRepository(db)
materialService := wire.ProvideMaterialService(materialSubjectRepository, materialFileRepository)
materialHandler := handler.NewMaterialHandler(materialService)
wsHandler := wire.ProvideWSHandler(hub, chatService, groupService, jwtService)
router := ProvideRouter(userHandler, postHandler, commentHandler, messageHandler, notificationHandler, uploadHandler, jwtService, pushHandler, systemMessageHandler, groupHandler, stickerHandler, voteHandler, channelHandler, scheduleHandler, roleHandler, adminUserHandler, adminPostHandler, adminCommentHandler, adminGroupHandler, adminDashboardHandler, adminLogHandler, qrCodeHandler, materialHandler, logService, userActivityService, casbinService, wsHandler)
hotRankWorker := wire.ProvideHotRankWorker(config, postRepository, cache)
app := NewApp(config, db, router, pushService, hotRankWorker, server, logger)