refactor(channelserver): extract UserRepository for users table access

Centralizes all 31 direct users-table SQL queries from 11 handler
files into a single UserRepository, following the same pattern as
CharacterRepository and GuildRepository. The only excluded query is
the sign_sessions JOIN in handleMsgSysLogin which spans multiple
tables.
This commit is contained in:
Houmgaor
2026-02-20 22:18:46 +01:00
parent d2a9b0ba5c
commit ab9fd0bc9c
12 changed files with 265 additions and 48 deletions

View File

@@ -102,7 +102,7 @@ func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) {
return
}
_, err = s.server.db.Exec("UPDATE users SET last_character=$1 WHERE id=$2", s.charID, s.userID)
err = s.server.userRepo.SetLastCharacter(s.userID, s.charID)
if err != nil {
s.logger.Error("Failed to update last character", zap.Error(err))
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))