refactor: update repository interfaces and improve dependency injection
- Refactored repository structures to use interfaces instead of concrete types, enhancing flexibility and testability. - Updated various repository methods to accept interfaces, allowing for better dependency management. - Modified wire generation to accommodate new repository interfaces, ensuring proper service injection throughout the application. - Enhanced handler methods to utilize DTOs for filtering and data handling, improving code clarity and maintainability.
This commit is contained in:
@@ -28,21 +28,21 @@ type AdminDashboardService interface {
|
||||
// adminDashboardServiceImpl 管理端仪表盘服务实现
|
||||
type adminDashboardServiceImpl struct {
|
||||
db *gorm.DB
|
||||
userRepo *repository.UserRepository
|
||||
postRepo *repository.PostRepository
|
||||
commentRepo *repository.CommentRepository
|
||||
userRepo repository.UserRepository
|
||||
postRepo repository.PostRepository
|
||||
commentRepo repository.CommentRepository
|
||||
groupRepo repository.GroupRepository
|
||||
activityRepo *repository.UserActivityRepository
|
||||
activityRepo repository.UserActivityRepository
|
||||
}
|
||||
|
||||
// NewAdminDashboardService 创建管理端仪表盘服务
|
||||
func NewAdminDashboardService(
|
||||
db *gorm.DB,
|
||||
userRepo *repository.UserRepository,
|
||||
postRepo *repository.PostRepository,
|
||||
commentRepo *repository.CommentRepository,
|
||||
userRepo repository.UserRepository,
|
||||
postRepo repository.PostRepository,
|
||||
commentRepo repository.CommentRepository,
|
||||
groupRepo repository.GroupRepository,
|
||||
activityRepo *repository.UserActivityRepository,
|
||||
activityRepo repository.UserActivityRepository,
|
||||
) AdminDashboardService {
|
||||
return &adminDashboardServiceImpl{
|
||||
db: db,
|
||||
|
||||
Reference in New Issue
Block a user