feat(coderd): add new dispatch logic for coder inbox (#16764)

This PR is [resolving the dispatch part of Coder
Inbocx](https://github.com/coder/internal/issues/403).

Since the DB layer has been merged - we now want to insert notifications
into Coder Inbox in parallel of the other delivery target.

To do so, we push two messages instead of one using the `Enqueue`
method.
This commit is contained in:
Vincent Vielle
2025-03-05 22:43:18 +01:00
committed by GitHub
parent 32450a2f77
commit 522181fead
42 changed files with 415 additions and 120 deletions
+4 -2
View File
@@ -25,6 +25,8 @@ type Store interface {
GetNotificationsSettings(ctx context.Context) (string, error)
GetApplicationName(ctx context.Context) (string, error)
GetLogoURL(ctx context.Context) (string, error)
InsertInboxNotification(ctx context.Context, arg database.InsertInboxNotificationParams) (database.InboxNotification, error)
}
// Handler is responsible for preparing and delivering a notification by a given method.
@@ -35,6 +37,6 @@ type Handler interface {
// Enqueuer enqueues a new notification message in the store and returns its ID, should it enqueue without failure.
type Enqueuer interface {
Enqueue(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, createdBy string, targets ...uuid.UUID) (*uuid.UUID, error)
EnqueueWithData(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, data map[string]any, createdBy string, targets ...uuid.UUID) (*uuid.UUID, error)
Enqueue(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, createdBy string, targets ...uuid.UUID) ([]uuid.UUID, error)
EnqueueWithData(ctx context.Context, userID, templateID uuid.UUID, labels map[string]string, data map[string]any, createdBy string, targets ...uuid.UUID) ([]uuid.UUID, error)
}