mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor(channelserver): extract RengokuRepository and MailRepository
Move all direct DB access from handlers_rengoku.go (11 calls) and handlers_mail.go (10 calls) into dedicated repository types, continuing the established extraction pattern. RengokuRepository provides UpsertScore and GetRanking, replacing a 3-call check/insert/update sequence and an 8-case switch of nearly identical queries respectively. MailRepository provides SendMail, SendMailTx, GetListForCharacter, GetByID, MarkRead, MarkDeleted, SetLocked, and MarkItemReceived. The old Mail.Send(), Mail.MarkRead(), GetMailListForCharacter, and GetMailByID free functions are removed. Guild handlers that sent mail via Mail.Send(s, ...) now call mailRepo directly.
This commit is contained in:
@@ -52,6 +52,8 @@ type Server struct {
|
||||
houseRepo *HouseRepository
|
||||
festaRepo *FestaRepository
|
||||
towerRepo *TowerRepository
|
||||
rengokuRepo *RengokuRepository
|
||||
mailRepo *MailRepository
|
||||
erupeConfig *_config.Config
|
||||
acceptConns chan net.Conn
|
||||
deleteConns chan net.Conn
|
||||
@@ -129,6 +131,8 @@ func NewServer(config *Config) *Server {
|
||||
s.houseRepo = NewHouseRepository(config.DB)
|
||||
s.festaRepo = NewFestaRepository(config.DB)
|
||||
s.towerRepo = NewTowerRepository(config.DB)
|
||||
s.rengokuRepo = NewRengokuRepository(config.DB)
|
||||
s.mailRepo = NewMailRepository(config.DB)
|
||||
|
||||
// Mezeporta
|
||||
s.stages["sl1Ns200p0a0u0"] = NewStage("sl1Ns200p0a0u0")
|
||||
|
||||
Reference in New Issue
Block a user