refactor(tower): extract tower logic into TowerService

The tower repo had business logic beyond simple CRUD: AddGem used a
fetch-transform-save pattern, progress capping was inline in the
handler, and RP donation orchestrated multiple repo calls with
conditional page advancement. Move these into a new TowerService
following the established service layer pattern.
This commit is contained in:
Houmgaor
2026-02-24 16:07:37 +01:00
parent 76d139538b
commit 7a56810e78
8 changed files with 322 additions and 56 deletions

View File

@@ -78,6 +78,11 @@ func ensureGachaService(s *Server) {
s.gachaService = NewGachaService(s.gachaRepo, s.userRepo, s.charRepo, s.logger, 100000)
}
// ensureTowerService wires the TowerService from the server's current repos.
func ensureTowerService(s *Server) {
s.towerService = NewTowerService(s.towerRepo, s.logger)
}
// createMockSession creates a minimal Session for testing.
// Imported from v9.2.x-stable and adapted for main.
func createMockSession(charID uint32, server *Server) *Session {