mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor(mail): extract mail logic into MailService
Introduce MailService as a convenience layer between handlers/services and MailRepo. Provides Send, SendSystem, SendGuildInvite, and BroadcastToGuild methods that encapsulate the boolean flag combinations. GuildService now depends on MailService instead of MailRepo directly, simplifying its mail-sending calls from verbose SendMail(..., false, true) to clean SendSystem(recipientID, subject, body). Guild mail broadcast logic moved from handleMsgMhfSendMail into MailService.BroadcastToGuild.
This commit is contained in:
@@ -265,9 +265,10 @@ func (m *mockGoocooRepo) SaveSlot(_ uint32, slot uint32, data []byte) error {
|
||||
// --- mockGuildRepo (minimal, for SendMail guild path) ---
|
||||
|
||||
type mockGuildRepoForMail struct {
|
||||
guild *Guild
|
||||
members []*GuildMember
|
||||
getErr error
|
||||
guild *Guild
|
||||
members []*GuildMember
|
||||
getErr error
|
||||
getMembersErr error
|
||||
}
|
||||
|
||||
func (m *mockGuildRepoForMail) GetByCharID(_ uint32) (*Guild, error) {
|
||||
@@ -278,6 +279,9 @@ func (m *mockGuildRepoForMail) GetByCharID(_ uint32) (*Guild, error) {
|
||||
}
|
||||
|
||||
func (m *mockGuildRepoForMail) GetMembers(_ uint32, _ bool) ([]*GuildMember, error) {
|
||||
if m.getMembersErr != nil {
|
||||
return nil, m.getMembersErr
|
||||
}
|
||||
return m.members, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user