scheduled

package
v0.1641.0-MLPAB2730suc... Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActionValues = ActionOptions{
	ExpireDonorIdentity:                        ActionExpireDonorIdentity,
	RemindCertificateProviderToComplete:        ActionRemindCertificateProviderToComplete,
	RemindCertificateProviderToConfirmIdentity: ActionRemindCertificateProviderToConfirmIdentity,
	RemindAttorneyToComplete:                   ActionRemindAttorneyToComplete,
}

Functions

This section is empty.

Types

type Action

type Action uint8
const (
	// ActionExpireDonorIdentity will check that the target donor has not signed
	// their LPA, and if so remove their identity data and notify them of the
	// change.
	ActionExpireDonorIdentity Action = iota + 1

	// ActionRemindCertificateProviderToComplete will check that the target
	// certificate provider has neither provided the certificate nor opted-out,
	// and if so send them a reminder email or letter, plus another to the donor
	// (or correspondent, if set).
	ActionRemindCertificateProviderToComplete

	// ActionRemindCertificateProviderToConfirmIdentity will check that the target
	// certificate provider has not confirmed their identity, and if so send them
	// a reminder email or letter, plus another to the donor (or correspondent, if
	// set).
	ActionRemindCertificateProviderToConfirmIdentity

	// ActionRemindAttorneyToComplete will check that the target attorney has
	// neither signed nor opted-out, and if so send them a reminder email or
	// letter, plus another to the donor (or correspondent, if set).
	ActionRemindAttorneyToComplete
)

func ParseAction

func ParseAction(s string) (Action, error)

func (Action) IsExpireDonorIdentity

func (i Action) IsExpireDonorIdentity() bool

func (Action) IsRemindAttorneyToComplete added in v0.1643.0

func (i Action) IsRemindAttorneyToComplete() bool

func (Action) IsRemindCertificateProviderToComplete added in v0.1643.0

func (i Action) IsRemindCertificateProviderToComplete() bool

func (Action) IsRemindCertificateProviderToConfirmIdentity added in v0.1643.0

func (i Action) IsRemindCertificateProviderToConfirmIdentity() bool

func (Action) MarshalText

func (i Action) MarshalText() ([]byte, error)

func (Action) String

func (i Action) String() string

func (*Action) UnmarshalText

func (i *Action) UnmarshalText(text []byte) error

type ActionFunc

type ActionFunc func(ctx context.Context, row *Event) error

type ActionOptions

type ActionOptions struct {
	ExpireDonorIdentity                        Action
	RemindCertificateProviderToComplete        Action
	RemindCertificateProviderToConfirmIdentity Action
	RemindAttorneyToComplete                   Action
}

type AttorneyStore added in v0.1615.0

type AttorneyStore interface {
	All(ctx context.Context, pk dynamo.LpaKeyType) ([]*attorneydata.Provided, error)
}

type Bundle added in v0.1610.0

type Bundle interface {
	For(lang localize.Lang) *localize.Localizer
}

type CertificateProviderStore added in v0.1610.0

type CertificateProviderStore interface {
	One(ctx context.Context, pk dynamo.LpaKeyType) (*certificateproviderdata.Provided, error)
}

type DonorStore

type DonorStore interface {
	One(ctx context.Context, pk dynamo.LpaKeyType, sk dynamo.SK) (*donordata.Provided, error)
	Put(ctx context.Context, provided *donordata.Provided) error
}

type DynamoClient

type DynamoClient interface {
	AllByLpaUIDAndPartialSK(ctx context.Context, uid string, partialSK dynamo.SK, v interface{}) error
	AnyByPK(ctx context.Context, pk dynamo.PK, v interface{}) error
	Move(ctx context.Context, oldKeys dynamo.Keys, value any) error
	DeleteKeys(ctx context.Context, keys []dynamo.Keys) error
	WriteTransaction(ctx context.Context, transaction *dynamo.Transaction) error
}

type Event

type Event struct {
	PK dynamo.ScheduledDayKeyType
	SK dynamo.ScheduledKeyType
	// CreatedAt is when the event was created
	CreatedAt time.Time
	// At is when the action should be done
	At time.Time
	// Action is what to do when run
	Action Action
	// TargetLpaKey is used to specify the target of the action
	TargetLpaKey dynamo.LpaKeyType
	// TargetLpaOwnerKey is used to specify the target of the action
	TargetLpaOwnerKey dynamo.LpaOwnerKeyType
	// LpaUID is the LPA UID the action target relates to
	LpaUID string
}

A Event specifies an action to take in the future.

type EventClient added in v0.1610.0

type EventClient interface {
	SendLetterRequested(ctx context.Context, event event.LetterRequested) error
}

type Logger

type Logger interface {
	InfoContext(ctx context.Context, msg string, args ...any)
	ErrorContext(ctx context.Context, msg string, args ...any)
}

type LpaStoreResolvingService added in v0.1610.0

type LpaStoreResolvingService interface {
	Resolve(ctx context.Context, provided *donordata.Provided) (*lpadata.Lpa, error)
}

type MetricsClient added in v0.1561.0

type MetricsClient interface {
	PutMetrics(ctx context.Context, input *cloudwatch.PutMetricDataInput) error
}

type NotifyClient

type NotifyClient interface {
	EmailGreeting(lpa *lpadata.Lpa) string
	SendActorEmail(ctx context.Context, to notify.ToEmail, lpaUID string, email notify.Email) error
}

type Runner

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

func NewRunner

func NewRunner(
	logger Logger,
	store ScheduledStore,
	donorStore DonorStore,
	certificateProviderStore CertificateProviderStore,
	attorneyStore AttorneyStore,
	lpaStoreResolvingService LpaStoreResolvingService,
	notifyClient NotifyClient,
	eventClient EventClient,
	bundle Bundle,
	metricsClient MetricsClient,
	metricsEnabled bool,
	appPublicURL string,
) *Runner

func (*Runner) Errored added in v0.1561.0

func (r *Runner) Errored(ctx context.Context, row *Event, err error)

func (*Runner) Ignored added in v0.1561.0

func (r *Runner) Ignored(ctx context.Context, row *Event)

func (*Runner) Metrics added in v0.1561.0

func (r *Runner) Metrics(processingTime time.Duration) cloudwatch.PutMetricDataInput

func (*Runner) Processed added in v0.1561.0

func (r *Runner) Processed(ctx context.Context, row *Event)

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

type ScheduledStore

type ScheduledStore interface {
	Pop(ctx context.Context, at time.Time) (*Event, error)
}

type Store

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

func NewStore

func NewStore(dynamoClient DynamoClient) *Store

func (*Store) Create added in v0.1576.0

func (s *Store) Create(ctx context.Context, rows ...Event) error

func (*Store) DeleteAllByUID added in v0.1576.0

func (s *Store) DeleteAllByUID(ctx context.Context, uid string) error

func (*Store) Pop

func (s *Store) Pop(ctx context.Context, day time.Time) (*Event, error)

type Waiter

type Waiter interface {
	Reset()
	Wait() error
}

Jump to

Keyboard shortcuts

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