mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-27 18:12:50 +01:00
refactor(channelserver): extract FestaRepository and TowerRepository
Move all direct DB calls from handlers_festa.go (23 calls across 8 tables) and handlers_tower.go (16 calls across 4 tables) into dedicated repository structs following the established pattern. FestaRepository (14 methods): lifecycle cleanup, event management, team souls, trial stats/rankings, user state, voting, registration, soul submission, prize claiming/enumeration. TowerRepository (12 methods): personal tower data (skills, progress, gems), guild tenrouirai progress/scores/page advancement, tower RP. Also fix pre-existing nil pointer panics in integration tests by adding SetTestDB helper that initializes both the DB connection and all repositories, and wire the done channel in createTestServerWithDB to prevent Shutdown panics.
This commit is contained in:
@@ -206,7 +206,7 @@ func TestHandleMsgMhfListMember_Integration(t *testing.T) {
|
||||
mock := &MockCryptConn{sentPackets: make([][]byte, 0)}
|
||||
s := createTestSession(mock)
|
||||
s.charID = charID
|
||||
s.server.db = db
|
||||
SetTestDB(s.server, db)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfListMember{
|
||||
AckHandle: 5678,
|
||||
@@ -313,7 +313,7 @@ func TestHandleMsgMhfOprMember_Integration(t *testing.T) {
|
||||
mock := &MockCryptConn{sentPackets: make([][]byte, 0)}
|
||||
s := createTestSession(mock)
|
||||
s.charID = charID
|
||||
s.server.db = db
|
||||
SetTestDB(s.server, db)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfOprMember{
|
||||
AckHandle: 9999,
|
||||
@@ -452,7 +452,7 @@ func TestListMember_EmptyDatabase_Integration(t *testing.T) {
|
||||
mock := &MockCryptConn{sentPackets: make([][]byte, 0)}
|
||||
s := createTestSession(mock)
|
||||
s.charID = charID
|
||||
s.server.db = db
|
||||
SetTestDB(s.server, db)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfListMember{
|
||||
AckHandle: 4444,
|
||||
@@ -528,7 +528,7 @@ func TestOprMember_EdgeCases_Integration(t *testing.T) {
|
||||
mock := &MockCryptConn{sentPackets: make([][]byte, 0)}
|
||||
s := createTestSession(mock)
|
||||
s.charID = charID
|
||||
s.server.db = db
|
||||
SetTestDB(s.server, db)
|
||||
|
||||
pkt := &mhfpacket.MsgMhfOprMember{
|
||||
AckHandle: 7777,
|
||||
|
||||
Reference in New Issue
Block a user