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:
Houmgaor
2026-02-24 00:05:56 +01:00
parent 1e9de7920d
commit 077c08fd49
9 changed files with 292 additions and 64 deletions

View File

@@ -7,9 +7,15 @@ import (
"go.uber.org/zap"
)
func newTestMailService(mr MailRepo, gr GuildRepo) *MailService {
logger, _ := zap.NewDevelopment()
return NewMailService(mr, gr, logger)
}
func newTestGuildService(gr GuildRepo, mr MailRepo) *GuildService {
logger, _ := zap.NewDevelopment()
return NewGuildService(gr, mr, nil, logger)
ms := newTestMailService(mr, gr)
return NewGuildService(gr, ms, nil, logger)
}
func TestGuildService_OperateMember(t *testing.T) {