Ejemplo n.º 1
0
func getNotifier(ctxt string, dbProvider dbprovider.DbInterface) (models.MailNotifier, error) {
	var notifier models.MailNotifier
	notifier, err := dbProvider.MailNotifierInterface().MailNotifier(ctxt)
	if err != nil {
		logger.Get().Warning("%s-Unable to read MailNotifier from DB: %v", ctxt, err)
		return notifier, err
	} else {
		return notifier, nil
	}
}
Ejemplo n.º 2
0
func getMailRecepients(ctxt string, dbProvider dbprovider.DbInterface) ([]string, error) {
	var users []models.User
	var recepients []string
	users, err := dbProvider.UserInterface().Users(bson.M{"notificationenabled": true})
	if err != nil {
		logger.Get().Critical(fmt.Sprintf("%s-Could not retrieve the list of users from DB. Error: %v", ctxt, err))
		return recepients, err
	}
	for _, user := range users {
		recepients = append(recepients, user.Email)
	}
	return recepients, nil
}