mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
refactor(channelserver): eliminate *sql.Tx from repository interfaces
Hide transaction management inside repository implementations so interfaces only expose domain types, enabling clean mocking and decoupling handlers from PostgreSQL internals. - Replace BeginTx + UpdateEventQuestStartTime with batch UpdateEventQuestStartTimes that manages its own transaction - Remove tx parameter from CreateApplication, add composite CreateApplicationWithMail for atomic scout+mail operations - Remove SendMailTx from MailRepo (sole caller migrated) - Remove database/sql import from repo_interfaces.go
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
@@ -102,10 +101,6 @@ func (m *mockMailRepo) SendMail(senderID, recipientID uint32, subject, body stri
|
||||
return m.sendErr
|
||||
}
|
||||
|
||||
func (m *mockMailRepo) SendMailTx(_ *sql.Tx, senderID, recipientID uint32, subject, body string, itemID, itemAmount uint16, isGuildInvite, isSystemMessage bool) error {
|
||||
return m.SendMail(senderID, recipientID, subject, body, itemID, itemAmount, isGuildInvite, isSystemMessage)
|
||||
}
|
||||
|
||||
// --- mockCharacterRepo ---
|
||||
|
||||
type mockCharacterRepo struct {
|
||||
@@ -271,7 +266,10 @@ func (m *mockGuildRepoForMail) Save(_ *Guild) error { return
|
||||
func (m *mockGuildRepoForMail) Disband(_ uint32) error { return nil }
|
||||
func (m *mockGuildRepoForMail) RemoveCharacter(_ uint32) error { return nil }
|
||||
func (m *mockGuildRepoForMail) AcceptApplication(_, _ uint32) error { return nil }
|
||||
func (m *mockGuildRepoForMail) CreateApplication(_, _, _ uint32, _ GuildApplicationType, _ *sql.Tx) error {
|
||||
func (m *mockGuildRepoForMail) CreateApplication(_, _, _ uint32, _ GuildApplicationType) error {
|
||||
return nil
|
||||
}
|
||||
func (m *mockGuildRepoForMail) CreateApplicationWithMail(_, _, _ uint32, _ GuildApplicationType, _, _ uint32, _, _ string) error {
|
||||
return nil
|
||||
}
|
||||
func (m *mockGuildRepoForMail) CancelInvitation(_, _ uint32) error { return nil }
|
||||
|
||||
Reference in New Issue
Block a user