code refactor

This commit is contained in:
MaysWind
2025-08-04 20:43:33 +08:00
parent d35e127b9e
commit 84523d8b8a
18 changed files with 163 additions and 95 deletions
+2 -7
View File
@@ -6,7 +6,6 @@ import (
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/datastore"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/mail"
"github.com/mayswind/ezbookkeeping/pkg/settings"
"github.com/mayswind/ezbookkeeping/pkg/storage"
@@ -61,7 +60,7 @@ type ServiceUsingConfig struct {
// CurrentConfig returns the current config
func (s *ServiceUsingConfig) CurrentConfig() *settings.Config {
return s.container.Current
return s.container.GetCurrentConfig()
}
// ServiceUsingMailer represents a service that need to use mailer
@@ -71,11 +70,7 @@ type ServiceUsingMailer struct {
// SendMail sends an email according to argument
func (s *ServiceUsingMailer) SendMail(message *mail.MailMessage) error {
if s.container.Current == nil {
return errs.ErrSMTPServerNotEnabled
}
return s.container.Current.SendMail(message)
return s.container.SendMail(message)
}
// ServiceUsingUuid represents a service that need to use uuid