mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor(channelserver): extract FestaRepository and TowerRepository
Move all direct DB calls from handlers_festa.go (23 calls across 8 tables) and handlers_tower.go (16 calls across 4 tables) into dedicated repository structs following the established pattern. FestaRepository (14 methods): lifecycle cleanup, event management, team souls, trial stats/rankings, user state, voting, registration, soul submission, prize claiming/enumeration. TowerRepository (12 methods): personal tower data (skills, progress, gems), guild tenrouirai progress/scores/page advancement, tower RP. Also fix pre-existing nil pointer panics in integration tests by adding SetTestDB helper that initializes both the DB connection and all repositories, and wire the done channel in createTestServerWithDB to prevent Shutdown panics.
This commit is contained in:
@@ -50,6 +50,8 @@ type Server struct {
|
||||
userRepo *UserRepository
|
||||
gachaRepo *GachaRepository
|
||||
houseRepo *HouseRepository
|
||||
festaRepo *FestaRepository
|
||||
towerRepo *TowerRepository
|
||||
erupeConfig *_config.Config
|
||||
acceptConns chan net.Conn
|
||||
deleteConns chan net.Conn
|
||||
@@ -125,6 +127,8 @@ func NewServer(config *Config) *Server {
|
||||
s.userRepo = NewUserRepository(config.DB)
|
||||
s.gachaRepo = NewGachaRepository(config.DB)
|
||||
s.houseRepo = NewHouseRepository(config.DB)
|
||||
s.festaRepo = NewFestaRepository(config.DB)
|
||||
s.towerRepo = NewTowerRepository(config.DB)
|
||||
|
||||
// Mezeporta
|
||||
s.stages["sl1Ns200p0a0u0"] = NewStage("sl1Ns200p0a0u0")
|
||||
|
||||
Reference in New Issue
Block a user