mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-27 01:53:19 +01:00
refactor(channelserver): extract CharacterRepository for characters table access
Centralizes all characters table SQL behind a CharacterRepository struct in repo_character.go. The 4 existing helpers (loadCharacterData, saveCharacterData, readCharacterInt, adjustCharacterInt) now delegate to the repository, keeping identical signatures so all ~70 callsites remain unchanged. Direct queries in handlers_session.go, sys_channel_server.go (DisconnectUser), and handlers_mail.go are also migrated. Pure refactor with zero behavior change — first step toward eliminating the ~130 scattered character queries identified in anti-patterns #9.
This commit is contained in:
@@ -193,16 +193,11 @@ func SendMailNotification(s *Session, m *Mail, recipient *Session) {
|
||||
}
|
||||
|
||||
func getCharacterName(s *Session, charID uint32) string {
|
||||
row := s.server.db.QueryRow("SELECT name FROM characters WHERE id = $1", charID)
|
||||
|
||||
charName := ""
|
||||
|
||||
err := row.Scan(&charName)
|
||||
|
||||
name, err := s.server.charRepo.GetName(charID)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return charName
|
||||
return name
|
||||
}
|
||||
|
||||
func handleMsgMhfReadMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
Reference in New Issue
Block a user