mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-25 09:03:10 +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:
@@ -55,10 +55,17 @@ func createMockServer() *Server {
|
||||
return s
|
||||
}
|
||||
|
||||
// ensureMailService wires the MailService from the server's current repos.
|
||||
// Call this after setting mailRepo and guildRepo on the mock server.
|
||||
func ensureMailService(s *Server) {
|
||||
s.mailService = NewMailService(s.mailRepo, s.guildRepo, s.logger)
|
||||
}
|
||||
|
||||
// ensureGuildService wires the GuildService from the server's current repos.
|
||||
// Call this after setting guildRepo, mailRepo, and charRepo on the mock server.
|
||||
func ensureGuildService(s *Server) {
|
||||
s.guildService = NewGuildService(s.guildRepo, s.mailRepo, s.charRepo, s.logger)
|
||||
ensureMailService(s)
|
||||
s.guildService = NewGuildService(s.guildRepo, s.mailService, s.charRepo, s.logger)
|
||||
}
|
||||
|
||||
// ensureAchievementService wires the AchievementService from the server's current repos.
|
||||
|
||||
Reference in New Issue
Block a user