notifications

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(router *gin.RouterGroup, deps *app.RuntimeDeps)

RegisterRoutes registers notification routes.

Types

type DeliveryJob

type DeliveryJob struct {
	ID        string
	TenantID  string
	Channel   string
	Status    string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type DeliveryJobPostgres

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

DeliveryJobPostgres implements Repository using PostgreSQL.

func (*DeliveryJobPostgres) CreateDelivery

func (r *DeliveryJobPostgres) CreateDelivery(ctx context.Context, in DeliveryJob) (DeliveryJob, error)

CreateDelivery creates a new delivery job record.

func (*DeliveryJobPostgres) MarkDelivered

func (r *DeliveryJobPostgres) MarkDelivered(ctx context.Context, jobID string) error

MarkDelivered updates the delivery job status to delivered.

func (*DeliveryJobPostgres) MarkFailed

func (r *DeliveryJobPostgres) MarkFailed(ctx context.Context, jobID string, reason string) error

MarkFailed updates the delivery job status to failed with a reason.

type EmailMessage

type EmailMessage struct {
	To      string
	Subject string
	Body    string
}

type NotificationHandler

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

NotificationHandler handles HTTP requests for notification operations.

func NewNotificationHandler

func NewNotificationHandler(service Service, logger *logger.Logger) *NotificationHandler

NewNotificationHandler creates a new notification handler.

func (*NotificationHandler) SendEmail

func (h *NotificationHandler) SendEmail(c *gin.Context)

SendEmail handles POST /notifications/email

type NotificationService

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

NotificationService implements the Service interface for notification operations.

func NewNotificationService

func NewNotificationService(logger *logger.Logger) (*NotificationService, error)

NewNotificationService creates a new notification service instance.

func (*NotificationService) QueueEmail

QueueEmail queues an email for sending and creates a delivery job record.

func (*NotificationService) WithProvider

func (s *NotificationService) WithProvider(p Provider) *NotificationService

WithProvider sets the provider for the notification service.

func (*NotificationService) WithRepository

func (s *NotificationService) WithRepository(r Repository) *NotificationService

WithRepository sets the repository for the notification service.

type Provider

type Provider interface {
	SendEmail(ctx context.Context, in EmailMessage) error
}

type QueueEmailInput

type QueueEmailInput struct {
	TenantID string
	To       string
	Subject  string
	Body     string
}

type Repository

type Repository interface {
	CreateDelivery(ctx context.Context, in DeliveryJob) (DeliveryJob, error)
	MarkDelivered(ctx context.Context, jobID string) error
	MarkFailed(ctx context.Context, jobID string, reason string) error
}

func NewDeliveryJobPostgres

func NewDeliveryJobPostgres(db *database.Postgres) Repository

NewDeliveryJobPostgres creates a new PostgreSQL delivery job repository.

type Service

type Service interface {
	QueueEmail(ctx context.Context, in QueueEmailInput) (DeliveryJob, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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