notifications

package
v0.0.0-...-bc78c8b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEventlogReportEmail

func GenerateEventlogReportEmail(
	amount float32,
	balance float32,
	startDate time.Time,
	endDate time.Time,
	eventsLog *[]domain.EventLog,
	pendingAssets *[]domain.Asset,
) (*bytes.Buffer, error)

Types

type EventsLogEmailFormat

type EventsLogEmailFormat struct {
	Date    string
	Message string
	ID      string
}

type Notification

type Notification domain.Notification

type PendingAssetsEmailFormat

type PendingAssetsEmailFormat struct {
	Date     string
	Amount   string
	BuyPrice string
	ID       string
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(repo domain.Repository) *Repository

NewAssetsRepository returns an instance of OrdersRepository

func (*Repository) BulkDelete

func (r *Repository) BulkDelete(filter bson.M) error

BulkDelete removes multiple notifications

func (*Repository) BulkDeleteByApplicationID

func (r *Repository) BulkDeleteByApplicationID(id string) error

BulkDeleteByApplicationID deletes all notifications associated with an application id

func (*Repository) Create

func (r *Repository) Create(notification *domain.Notification) error

Create inserts a new notification in collection

func (*Repository) FindLastEventLogsNotificationDate

func (r *Repository) FindLastEventLogsNotificationDate() (time.Time, error)

func (*Repository) Sent

func (r *Repository) Sent(id primitive.ObjectID) error

Sent updates notification as sent

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	notificationsRepository domain.NotificationsRepository,
	options domain.NotificationOptions,
	sendMail domain.SendMail,
	appID primitive.ObjectID,
) *Service

func (*Service) BulkDeleteByApplicationID

func (s *Service) BulkDeleteByApplicationID(id string) error

BulkDeleteByApplicationID deletes all notifications associated with an application id

func (*Service) CreateEmailNotification

func (n *Service) CreateEmailNotification(subject, message, notificationType string) error

CreateEmailNotification stores notification in repository and send email to Receiver

func (*Service) FindLastEventLogsNotificationDate

func (n *Service) FindLastEventLogsNotificationDate() (time.Time, error)

FindLastEventLogsNotificationDate returns last notification date

func (*Service) SendEmail

func (n *Service) SendEmail(subject, body string) error

SendEmail setup an email options and sends it

func (*Service) ShouldSendNotification

func (a *Service) ShouldSendNotification() bool

ShouldSendNotification verifies wheter last notification was sent more than 12 hours ago

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL