refactor(di): migrate from setter to constructor injection for logService
All checks were successful
Build Backend / build (push) Successful in 12m35s
Build Backend / build-docker (push) Successful in 1m2s

- Remove SetLogService methods from user, post, comment, and admin post services
- Add logService as constructor parameter to all dependent services
- Centralize call-related and message error definitions in app_errors.go
- Add ConversationID field to WSEventResponse for improved message tracking
- Simplify wire provider functions by removing manual setter calls
This commit is contained in:
lafay
2026-03-28 07:03:21 +08:00
parent d357998321
commit 736344f123
15 changed files with 203 additions and 254 deletions

View File

@@ -39,10 +39,11 @@ type UserHandler struct {
}
// NewUserHandler 创建用户处理器
func NewUserHandler(userService service.UserService, activityService service.UserActivityService) *UserHandler {
func NewUserHandler(userService service.UserService, activityService service.UserActivityService, logService *service.LogService) *UserHandler {
return &UserHandler{
userService: userService,
activityService: activityService,
logService: logService,
}
}
@@ -56,11 +57,6 @@ func (h *UserHandler) SetActivityService(activityService service.UserActivitySer
h.activityService = activityService
}
// SetLogService 设置日志服务
func (h *UserHandler) SetLogService(logService *service.LogService) {
h.logService = logService
}
// generateTokenID 生成Token ID
func generateTokenID(token string) string {
h := sha256.New()