Skip to content

usecase ​

go
import "github.com/prescriptoo/prescriptoo-api/services/notification/internal/usecase"

Package usecase contains single-task use case implementations.

Index ​

type CreateTemplateDTO ​

CreateTemplateDTO contains parameters to create a template.

go
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.

go
type CreateTemplateUseCase struct {
    // contains filtered or unexported fields
}

func NewCreateTemplateUseCase ​

go
func NewCreateTemplateUseCase(repo ports.TemplateRepository) *CreateTemplateUseCase

NewCreateTemplateUseCase instantiates a new CreateTemplateUseCase.

func (*CreateTemplateUseCase) Execute ​

go
func (uc *CreateTemplateUseCase) Execute(ctx context.Context, dto CreateTemplateDTO) (*domain.Template, error)

Execute creates a new template.

type GetNotificationUseCase ​

GetNotificationUseCase handles retrieving a notification.

go
type GetNotificationUseCase struct {
    // contains filtered or unexported fields
}

func NewGetNotificationUseCase ​

go
func NewGetNotificationUseCase(repo ports.NotificationRepository) *GetNotificationUseCase

NewGetNotificationUseCase instantiates a new GetNotificationUseCase.

func (*GetNotificationUseCase) Execute ​

go
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.

go
type GetTemplateUseCase struct {
    // contains filtered or unexported fields
}

func NewGetTemplateUseCase ​

go
func NewGetTemplateUseCase(repo ports.TemplateRepository) *GetTemplateUseCase

NewGetTemplateUseCase instantiates a new GetTemplateUseCase.

func (*GetTemplateUseCase) Execute ​

go
func (uc *GetTemplateUseCase) Execute(ctx context.Context, id string) (*domain.Template, error)

Execute retrieves a template by ID.

type ListNotificationsUseCase ​

ListNotificationsUseCase handles listing notifications.

go
type ListNotificationsUseCase struct {
    // contains filtered or unexported fields
}

func NewListNotificationsUseCase ​

go
func NewListNotificationsUseCase(repo ports.NotificationRepository) *ListNotificationsUseCase

NewListNotificationsUseCase instantiates a new ListNotificationsUseCase.

func (*ListNotificationsUseCase) Execute ​

go
func (uc *ListNotificationsUseCase) Execute(ctx context.Context, recipient string) ([]*domain.Notification, error)

Execute lists notifications by recipient.

type ListTemplatesUseCase ​

ListTemplatesUseCase handles listing templates.

go
type ListTemplatesUseCase struct {
    // contains filtered or unexported fields
}

func NewListTemplatesUseCase ​

go
func NewListTemplatesUseCase(repo ports.TemplateRepository) *ListTemplatesUseCase

NewListTemplatesUseCase instantiates a new ListTemplatesUseCase.

func (*ListTemplatesUseCase) Execute ​

go
func (uc *ListTemplatesUseCase) Execute(ctx context.Context) ([]*domain.Template, error)

Execute lists all templates.

type SendNotificationDTO ​

SendNotificationDTO contains parameters to send a notification.

go
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.

go
type SendNotificationUseCase struct {
    // contains filtered or unexported fields
}

func NewSendNotificationUseCase ​

go
func NewSendNotificationUseCase(notificationRepo ports.NotificationRepository, templateRepo ports.TemplateRepository, emailProvider ports.EmailProvider, smsProvider ports.SMSProvider) *SendNotificationUseCase

NewSendNotificationUseCase instantiates a new SendNotificationUseCase.

func (*SendNotificationUseCase) Execute ​

go
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.

go
type UpdateTemplateUseCase struct {
    // contains filtered or unexported fields
}

func NewUpdateTemplateUseCase ​

go
func NewUpdateTemplateUseCase(repo ports.TemplateRepository) *UpdateTemplateUseCase

NewUpdateTemplateUseCase instantiates a new UpdateTemplateUseCase.

func (*UpdateTemplateUseCase) Execute ​

go
func (uc *UpdateTemplateUseCase) Execute(ctx context.Context, id string, dto CreateTemplateDTO) (*domain.Template, error)

Execute updates a template.

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.