domain

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("domain", fx.Provide(func(e *env.Env,
	notificationRepo repos.DbRepo[*types.Notification],
	subscriptionRepo repos.DbRepo[*entities.Subscription],
	notificationConfigRepo repos.DbRepo[*entities.NotificationConf],

	logger logging.Logger,
	iamClient iam.IAMClient,

	resourceEventPublisher ResourceEventPublisher,

	eTemplates *EmailTemplates,
	mailer mail.Mailer,
) (Domain, error) {
	return &Impl{
		iamClient: iamClient,
		envs:      e,
		logger:    logger,

		resourceEventPublisher: resourceEventPublisher,

		notificationRepo:       notificationRepo,
		subscriptionRepo:       subscriptionRepo,
		notificationConfigRepo: notificationConfigRepo,
		mailer:                 mailer,
		eTemplates:             eTemplates,
	}, nil
}))

Functions

This section is empty.

Types

type CommsContext

type CommsContext struct {
	context.Context
	UserId      repos.ID
	UserName    string
	AccountName string
	UserEmail   string
}

func (CommsContext) GetAccountName

func (c CommsContext) GetAccountName() string

func (CommsContext) GetUserEmail

func (c CommsContext) GetUserEmail() string

func (CommsContext) GetUserId

func (c CommsContext) GetUserId() repos.ID

func (CommsContext) GetUserName

func (c CommsContext) GetUserName() string

type Domain

type Domain interface {
	ListNotifications(ctx CommsContext, pagination repos.CursorPagination) (*repos.PaginatedRecord[*types.Notification], error)
	MarkNotificationAsRead(ctx CommsContext, id repos.ID) (*types.Notification, error)
	MarkAllNotificationsAsRead(ctx CommsContext) error

	GetNotificationConfig(ctx CommsContext) (*entities.NotificationConf, error)
	UpdateNotificationConfig(ctx CommsContext, config entities.NotificationConf) (*entities.NotificationConf, error)

	UpdateSubscriptionConfig(ctx CommsContext, id repos.ID, config entities.Subscription) (*entities.Subscription, error)
	GetSubscriptionConfig(ctx CommsContext, id repos.ID) (*entities.Subscription, error)

	Notify(ctx context.Context, notification *types.Notification) error
}

type EmailTemplate

type EmailTemplate struct {
	Subject   string
	Html      *template.Template
	PlainText *template.Template
}

type EmailTemplates

type EmailTemplates struct {
	AccountInviteEmail    *EmailTemplate
	ProjectInviteEmail    *EmailTemplate
	ResetPasswordEmail    *EmailTemplate
	UserVerificationEmail *EmailTemplate
	WelcomeEmail          *EmailTemplate
	WaitingEmail          *EmailTemplate
	AlertEmail            *EmailTemplate
	ContactUsEmail        *EmailTemplate
}

func GetEmailTemplates

func GetEmailTemplates(et EmailTemplatesDir) (*EmailTemplates, error)

type EmailTemplatesDir

type EmailTemplatesDir struct {
	embed.FS
}

type Impl

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

func (*Impl) GetNotificationConfig

func (d *Impl) GetNotificationConfig(ctx CommsContext) (*entities.NotificationConf, error)

func (*Impl) GetSubscriptionConfig

func (d *Impl) GetSubscriptionConfig(ctx CommsContext, id repos.ID) (*entities.Subscription, error)

func (*Impl) ListNotifications

func (d *Impl) ListNotifications(ctx CommsContext, pagination repos.CursorPagination) (*repos.PaginatedRecord[*types.Notification], error)

func (*Impl) MarkAllNotificationsAsRead

func (d *Impl) MarkAllNotificationsAsRead(ctx CommsContext) error

func (*Impl) MarkNotificationAsRead

func (d *Impl) MarkNotificationAsRead(ctx CommsContext, id repos.ID) (*types.Notification, error)

func (*Impl) Notify

func (d *Impl) Notify(ctx context.Context, notification *types.Notification) error

func (*Impl) UpdateNotificationConfig

func (d *Impl) UpdateNotificationConfig(ctx CommsContext, config entities.NotificationConf) (*entities.NotificationConf, error)

func (*Impl) UpdateSubscriptionConfig

func (d *Impl) UpdateSubscriptionConfig(ctx CommsContext, id repos.ID, config entities.Subscription) (*entities.Subscription, error)

type PublishMsg

type PublishMsg string
const (
	PublishAdd    PublishMsg = "added"
	PublishDelete PublishMsg = "deleted"
	PublishUpdate PublishMsg = "updated"
)

type ResourceEventPublisher

type ResourceEventPublisher interface {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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