notificationSender

package
v4.25.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Example (NotificationDBSave)
db := wstestlib.GetDB()
ctx := context.TODO()

// Clear relevant collections
db.Collection(dbCollections.NotificationsName).Drop(ctx)

notif := &protos.Notification{
	Id:               "ajm5d5bjs4vq7bkc-auth0|5de45d85ca40070f421a3a34",
	DestUserId:       "auth0|5de45d85ca40070f421a3a34",
	Subject:          "Quantification Peters combined v4 test quant has completed with status: Complete",
	Contents:         "A quantification named Peters combined v4 test quant (id: quant-wqp66sayhowj41ej) has completed with status Complete. This quantification is for the scan named: Castle Geyser",
	From:             "Data Importer",
	TimeStampUnixSec: 1710831761,
	ActionLink:       "?q=393871873&quant=quant-wqp66sayhowj41ej",
	NotificationType: protos.NotificationType_NT_USER_MESSAGE,
}

n := MakeNotificationSender("abc123", db, nil, nil, &logger.StdOutLoggerForTest{}, "unittest", nil, nil)
fmt.Printf("Notification write to empty DB: %v\n", n.saveNotificationToDB("notif123", "destuser123", notif))
fmt.Printf("Notification overwrite: %v", n.saveNotificationToDB("notif123", "destuser123", notif))
Output:

Notification write to empty DB: <nil>
Notification overwrite: <nil>

Index

Examples

Constants

This section is empty.

Variables

View Source
var NOTIF_TOPIC_IMAGE_NEW = "New Image For Dataset"
View Source
var NOTIF_TOPIC_OBJECT_SHARED = "Object Shared"
View Source
var NOTIF_TOPIC_QUANT_COMPLETE = "Qunatification Complete"
View Source
var NOTIF_TOPIC_SCAN_NEW = "New Dataset Available"

NOTE: This must be in sync with the client! It saves user notification settings with topic strings

and these have to match what the UI is setting for the topic field or the user setting lookup
will fail and we won't send out that notification

At time of writing, these are defined in:

pixlise-ui\client\src\app\modules\settings\models\notification.model.ts
View Source
var NOTIF_TOPIC_SCAN_UPDATED = "Dataset Updated"

Functions

This section is empty.

Types

type NotificationSender

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

func MakeNotificationSender

func MakeNotificationSender(instanceId string, db *mongo.Database, idgen idgen.IDGenerator, timestamper timestamper.ITimeStamper, log logger.ILogger, envRootURL string, ws *ws.WSHandler, melody *melody.Melody) *NotificationSender

func (*NotificationSender) NotifyNewQuant

func (n *NotificationSender) NotifyNewQuant(uploaded bool, quantId string, quantName string, status string, scanName string, scanId string)

func (*NotificationSender) NotifyNewScan

func (n *NotificationSender) NotifyNewScan(scanName string, scanId string)

func (*NotificationSender) NotifyNewScanImage

func (n *NotificationSender) NotifyNewScanImage(scanName string, scanId string, imageName string)

func (*NotificationSender) NotifyObjectShared

func (n *NotificationSender) NotifyObjectShared(objectType string, objectId string, objectName, sharerName string)

func (*NotificationSender) NotifyUpdatedScan

func (n *NotificationSender) NotifyUpdatedScan(scanName string, scanId string)

func (*NotificationSender) NotifyUserGroupMessage

func (n *NotificationSender) NotifyUserGroupMessage(subject string, message string, notificationType protos.NotificationType, actionLink string, groupId string, groupName string, sender string)

func (*NotificationSender) NotifyUserMessage added in v4.0.2

func (n *NotificationSender) NotifyUserMessage(subject string, message string, notificationType protos.NotificationType, actionLink string, requestorUserId string, destUserIds []string, sender string)

func (*NotificationSender) SysNotifyQuantChanged

func (n *NotificationSender) SysNotifyQuantChanged(quantId string)

func (*NotificationSender) SysNotifyScanChanged

func (n *NotificationSender) SysNotifyScanChanged(scanId string)

func (*NotificationSender) SysNotifyScanImagesChanged

func (n *NotificationSender) SysNotifyScanImagesChanged(imageName string, scanIds []string)

Jump to

Keyboard shortcuts

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