add method for direct notification sending

This commit is contained in:
GotPPay
2018-05-28 17:18:44 +02:00
parent fc3029c6c3
commit ab055d8a61
2 changed files with 58 additions and 4 deletions

View File

@@ -120,12 +120,16 @@ func (c *controller) handle(ctx echo.Context) error {
return routeutils.HandleAPIError(ctx, err)
}
fmt.Println("\n\nSend email\n\n")
//Send email notification to Authorized user
notifications := make([]viewmodel.Notification, 1)
notifications = append(notifications, viewmodel.Notification{Type: "email", From: c.cfg.Email.Sender, To: *user.Email, Subject: notificationEmailSubject, Message: notificationEmailBody})
notification := viewmodel.Notification{
Type: "email",
From: c.cfg.Email.Sender,
To: *user.Email,
Subject: notificationEmailSubject,
Message: notificationEmailBody,
}
notifications, err = c.svc.Notification.SendNotifications(notifications)
notification, err = c.svc.Notification.SendNotificationWithoutWritingToDatabase(notification)
if err != nil {
return routeutils.HandleAPIError(ctx, err)
}