usecase
import "github.com/prescriptoo/prescriptoo-api/services/notification/internal/usecase"Package usecase contains single-task use case implementations.
Index
- type CreateTemplateDTO
- type CreateTemplateUseCase
- type GetNotificationUseCase
- type GetTemplateUseCase
- type ListNotificationsUseCase
- type ListTemplatesUseCase
- type SendNotificationDTO
- type SendNotificationUseCase
- func NewSendNotificationUseCase(notificationRepo ports.NotificationRepository, templateRepo ports.TemplateRepository, emailProvider ports.EmailProvider, smsProvider ports.SMSProvider) *SendNotificationUseCase
- func (uc *SendNotificationUseCase) Execute(ctx context.Context, dto SendNotificationDTO) (*domain.Notification, error)
- type UpdateTemplateUseCase
type CreateTemplateDTO
CreateTemplateDTO contains parameters to create a template.
type CreateTemplateDTO struct {
Name string `json:"name"`
Channel domain.Channel `json:"channel"`
Subject string `json:"subject"`
Body string `json:"body"`
Variables []string `json:"variables"`
}type CreateTemplateUseCase
CreateTemplateUseCase handles creating templates.
type CreateTemplateUseCase struct {
// contains filtered or unexported fields
}func NewCreateTemplateUseCase
func NewCreateTemplateUseCase(repo ports.TemplateRepository) *CreateTemplateUseCaseNewCreateTemplateUseCase instantiates a new CreateTemplateUseCase.
func (*CreateTemplateUseCase) Execute
func (uc *CreateTemplateUseCase) Execute(ctx context.Context, dto CreateTemplateDTO) (*domain.Template, error)Execute creates a new template.
type GetNotificationUseCase
GetNotificationUseCase handles retrieving a notification.
type GetNotificationUseCase struct {
// contains filtered or unexported fields
}func NewGetNotificationUseCase
func NewGetNotificationUseCase(repo ports.NotificationRepository) *GetNotificationUseCaseNewGetNotificationUseCase instantiates a new GetNotificationUseCase.
func (*GetNotificationUseCase) Execute
func (uc *GetNotificationUseCase) Execute(ctx context.Context, id string) (*domain.Notification, error)Execute retrieves a notification by ID.
type GetTemplateUseCase
GetTemplateUseCase handles retrieving a template.
type GetTemplateUseCase struct {
// contains filtered or unexported fields
}func NewGetTemplateUseCase
func NewGetTemplateUseCase(repo ports.TemplateRepository) *GetTemplateUseCaseNewGetTemplateUseCase instantiates a new GetTemplateUseCase.
func (*GetTemplateUseCase) Execute
func (uc *GetTemplateUseCase) Execute(ctx context.Context, id string) (*domain.Template, error)Execute retrieves a template by ID.
type ListNotificationsUseCase
ListNotificationsUseCase handles listing notifications.
type ListNotificationsUseCase struct {
// contains filtered or unexported fields
}func NewListNotificationsUseCase
func NewListNotificationsUseCase(repo ports.NotificationRepository) *ListNotificationsUseCaseNewListNotificationsUseCase instantiates a new ListNotificationsUseCase.
func (*ListNotificationsUseCase) Execute
func (uc *ListNotificationsUseCase) Execute(ctx context.Context, recipient string) ([]*domain.Notification, error)Execute lists notifications by recipient.
type ListTemplatesUseCase
ListTemplatesUseCase handles listing templates.
type ListTemplatesUseCase struct {
// contains filtered or unexported fields
}func NewListTemplatesUseCase
func NewListTemplatesUseCase(repo ports.TemplateRepository) *ListTemplatesUseCaseNewListTemplatesUseCase instantiates a new ListTemplatesUseCase.
func (*ListTemplatesUseCase) Execute
func (uc *ListTemplatesUseCase) Execute(ctx context.Context) ([]*domain.Template, error)Execute lists all templates.
type SendNotificationDTO
SendNotificationDTO contains parameters to send a notification.
type SendNotificationDTO struct {
Channel domain.Channel `json:"channel"`
Recipient string `json:"recipient"`
TemplateID string `json:"template_id"`
Variables map[string]any `json:"variables"`
}type SendNotificationUseCase
SendNotificationUseCase handles sending notifications.
type SendNotificationUseCase struct {
// contains filtered or unexported fields
}func NewSendNotificationUseCase
func NewSendNotificationUseCase(notificationRepo ports.NotificationRepository, templateRepo ports.TemplateRepository, emailProvider ports.EmailProvider, smsProvider ports.SMSProvider) *SendNotificationUseCaseNewSendNotificationUseCase instantiates a new SendNotificationUseCase.
func (*SendNotificationUseCase) Execute
func (uc *SendNotificationUseCase) Execute(ctx context.Context, dto SendNotificationDTO) (*domain.Notification, error)Execute sends a notification using a template.
type UpdateTemplateUseCase
UpdateTemplateUseCase handles updating templates.
type UpdateTemplateUseCase struct {
// contains filtered or unexported fields
}func NewUpdateTemplateUseCase
func NewUpdateTemplateUseCase(repo ports.TemplateRepository) *UpdateTemplateUseCaseNewUpdateTemplateUseCase instantiates a new UpdateTemplateUseCase.
func (*UpdateTemplateUseCase) Execute
func (uc *UpdateTemplateUseCase) Execute(ctx context.Context, id string, dto CreateTemplateDTO) (*domain.Template, error)Execute updates a template.
Generated by gomarkdoc