feat: add asset level provider for dependency injection
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
391ef8c43d
commit
037b7cc3f9
@ -0,0 +1,35 @@
|
|||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/topfans/backend/services/assetService/repository"
|
||||||
|
"github.com/topfans/backend/services/assetService/service"
|
||||||
|
"github.com/topfans/backend/services/assetService/worker"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AssetLevelProvider struct {
|
||||||
|
LevelService service.AssetLevelService
|
||||||
|
db *gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAssetLevelProvider(db *gorm.DB) *AssetLevelProvider {
|
||||||
|
levelRepo := repository.NewAssetLevelRepository(db)
|
||||||
|
seasonRepo := repository.NewSeasonRepository(db)
|
||||||
|
decayConfigRepo := repository.NewSeasonDecayConfigRepository(db)
|
||||||
|
|
||||||
|
levelService := service.NewAssetLevelService(levelRepo, seasonRepo, decayConfigRepo)
|
||||||
|
|
||||||
|
return &AssetLevelProvider{
|
||||||
|
LevelService: levelService,
|
||||||
|
db: db,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *AssetLevelProvider) GetLevelService() service.AssetLevelService {
|
||||||
|
return p.LevelService
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *AssetLevelProvider) GetSeasonResetWorker() *worker.SeasonResetWorker {
|
||||||
|
seasonRepo := repository.NewSeasonRepository(p.db)
|
||||||
|
return worker.NewSeasonResetWorker(seasonRepo, p.LevelService)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user