refactor(channelserver): introduce repository interfaces for all 21 repos

Replace concrete pointer types on the Server struct with interfaces to
decouple handlers from PostgreSQL implementations. This enables mock/stub
injection for unit tests and opens the door to alternative storage
backends (SQLite, in-memory).

Also adds 9 missing repo initializations to SetTestDB() (event,
achievement, shop, cafe, goocoo, diva, misc, scenario, mercenary)
to match NewServer().
This commit is contained in:
Houmgaor
2026-02-21 13:52:28 +01:00
parent 3b044fb987
commit 1d5026c3a5
3 changed files with 363 additions and 21 deletions

View File

@@ -40,27 +40,27 @@ type Server struct {
Port uint16
logger *zap.Logger
db *sqlx.DB
charRepo *CharacterRepository
guildRepo *GuildRepository
userRepo *UserRepository
gachaRepo *GachaRepository
houseRepo *HouseRepository
festaRepo *FestaRepository
towerRepo *TowerRepository
rengokuRepo *RengokuRepository
mailRepo *MailRepository
stampRepo *StampRepository
distRepo *DistributionRepository
sessionRepo *SessionRepository
eventRepo *EventRepository
achievementRepo *AchievementRepository
shopRepo *ShopRepository
cafeRepo *CafeRepository
goocooRepo *GoocooRepository
divaRepo *DivaRepository
miscRepo *MiscRepository
scenarioRepo *ScenarioRepository
mercenaryRepo *MercenaryRepository
charRepo CharacterRepo
guildRepo GuildRepo
userRepo UserRepo
gachaRepo GachaRepo
houseRepo HouseRepo
festaRepo FestaRepo
towerRepo TowerRepo
rengokuRepo RengokuRepo
mailRepo MailRepo
stampRepo StampRepo
distRepo DistributionRepo
sessionRepo SessionRepo
eventRepo EventRepo
achievementRepo AchievementRepo
shopRepo ShopRepo
cafeRepo CafeRepo
goocooRepo GoocooRepo
divaRepo DivaRepo
miscRepo MiscRepo
scenarioRepo ScenarioRepo
mercenaryRepo MercenaryRepo
erupeConfig *cfg.Config
acceptConns chan net.Conn
deleteConns chan net.Conn