QOR Notification
QOR Notification provides a way to send notifications to QOR Admin administrators. Notifications can be anything your system needs, like order update, delivery notices, whatever.
Usage
Notification := notification.New(¬ification.Config{})
Admin.NewResource(Notification)
Notification.RegisterChannel(database.New(&database.Config{DB: db.DB}))
Notification.Send(message *Message, context *qor.Context)
Notification.GetNotification(user interface{}, messageID string, context *qor.Context)
Notification.GetNotifications(user interface{}, context *qor.Context)
Notification.GetUnresolvedNotificationsCount(user interface{}, context *qor.Context)
The Notifications List in QOR Admin looks a bit like this when populated:

Register Actions for Notification
This example shows how to add a "Dismiss" button to notification. The button will appears in the notification which ResolvedAt
is nil. Please read the Action documentation for more details.
Notification.Action(¬ification.Action{
Name: "Dismiss",
MessageTypes: []string{"info", "order_processed", "order_returned"},
Visible: func(data *notification.QorNotification, context *admin.Context) bool {
return data.ResolvedAt == nil
},
Handle: func(argument *notification.ActionArgument) error {
return argument.Context.GetDB().Model(argument.Message).Update("resolved_at", time.Now()).Error
},
})
License
Released under the MIT License.