mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor(channelserver): extract GuildRepository for guild table access
Per anti-patterns.md item #9, guild-related SQL was scattered across ~15 handler files with no repository abstraction. Following the same pattern established by CharacterRepository, this centralizes all guilds, guild_characters, and guild_applications table access into a single GuildRepository (~30 methods). guild_model.go and handlers_guild_member.go are trimmed to types and pure business logic only. All handler files (guild_*, festa, mail, house, mercenary, rengoku) now call s.server.guildRepo methods instead of direct DB queries or methods on domain objects.
This commit is contained in:
@@ -46,6 +46,7 @@ type Server struct {
|
||||
logger *zap.Logger
|
||||
db *sqlx.DB
|
||||
charRepo *CharacterRepository
|
||||
guildRepo *GuildRepository
|
||||
erupeConfig *_config.Config
|
||||
acceptConns chan net.Conn
|
||||
deleteConns chan net.Conn
|
||||
@@ -117,6 +118,7 @@ func NewServer(config *Config) *Server {
|
||||
}
|
||||
|
||||
s.charRepo = NewCharacterRepository(config.DB)
|
||||
s.guildRepo = NewGuildRepository(config.DB)
|
||||
|
||||
// Mezeporta
|
||||
s.stages["sl1Ns200p0a0u0"] = NewStage("sl1Ns200p0a0u0")
|
||||
|
||||
Reference in New Issue
Block a user