mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-26 01:23:13 +01:00
refactor(achievement): extract achievement logic into AchievementService
Move EnsureExists + GetAllScores + compute loop from handler into AchievementService.GetAll, and validation + ensure + increment into AchievementService.Increment. Handlers now delegate to the service layer for business logic while retaining protocol response building. GetAchData stays as a pure function in handlers_achievement.go per plan.
This commit is contained in:
@@ -61,6 +61,11 @@ func ensureGuildService(s *Server) {
|
||||
s.guildService = NewGuildService(s.guildRepo, s.mailRepo, s.charRepo, s.logger)
|
||||
}
|
||||
|
||||
// ensureAchievementService wires the AchievementService from the server's current repos.
|
||||
func ensureAchievementService(s *Server) {
|
||||
s.achievementService = NewAchievementService(s.achievementRepo, 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 {
|
||||
|
||||
Reference in New Issue
Block a user