refactor(channelserver): extract StampRepository, DistributionRepository, and SessionRepository

Eliminate 18 direct s.server.db calls from handlers_items.go,
handlers_distitem.go, and handlers_session.go by moving queries into
dedicated repository types.

New repositories:
- StampRepository (7 methods, stamps table)
- DistributionRepository (4 methods, distribution/distribution_items)
- SessionRepository (4 methods, sign_sessions/servers)

Also adds ClearTreasureHunt and InsertKillLog to GuildRepository,
which already owns those tables for read operations.
This commit is contained in:
Houmgaor
2026-02-21 00:06:23 +01:00
parent eb66de8ef9
commit d640bec8af
10 changed files with 224 additions and 67 deletions

View File

@@ -55,6 +55,9 @@ type Server struct {
towerRepo *TowerRepository
rengokuRepo *RengokuRepository
mailRepo *MailRepository
stampRepo *StampRepository
distRepo *DistributionRepository
sessionRepo *SessionRepository
erupeConfig *_config.Config
acceptConns chan net.Conn
deleteConns chan net.Conn
@@ -134,6 +137,9 @@ func NewServer(config *Config) *Server {
s.towerRepo = NewTowerRepository(config.DB)
s.rengokuRepo = NewRengokuRepository(config.DB)
s.mailRepo = NewMailRepository(config.DB)
s.stampRepo = NewStampRepository(config.DB)
s.distRepo = NewDistributionRepository(config.DB)
s.sessionRepo = NewSessionRepository(config.DB)
// Mezeporta
s.stages["sl1Ns200p0a0u0"] = NewStage("sl1Ns200p0a0u0")