1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: mail service abstraction layer

This commit is contained in:
Ferdinand Mütsch
2021-04-30 15:14:29 +02:00
parent 29c04c3ac5
commit a4e7158db2
10 changed files with 128 additions and 144 deletions

View File

@ -3,24 +3,11 @@ package mail
import (
"github.com/emvi/logbuch"
"github.com/muety/wakapi/models"
"time"
)
type NoopMailService struct{}
type NoopSendingService struct{}
const notImplemented = "noop mail service doing nothing instead of sending password reset mail to %s"
func (n *NoopMailService) SendReport(recipient *models.User, report *models.Report) error {
logbuch.Info(notImplemented, recipient.ID)
return nil
}
func (n *NoopMailService) SendPasswordReset(recipient *models.User, resetLink string) error {
logbuch.Info(notImplemented, recipient.ID)
return nil
}
func (n *NoopMailService) SendImportNotification(recipient *models.User, duration time.Duration, numHeartbeats int) error {
logbuch.Info(notImplemented, recipient.ID)
func (n *NoopSendingService) Send(mail *models.Mail) error {
logbuch.Info("noop mail service doing nothing instead of sending password reset mail to [%v]", mail.To.Strings())
return nil
}