Documentation
¶
Overview ¶
Package sweep implements the subscription lifecycle sweep: marking traffic-exceeded and expired subscriptions finished, then firing the retryable side effects (owner notification, cache invalidation). Only the module facade may reach it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
UserSubs repository.UserSubscriptionRepo
Plans repository.SubscribeRepo
Cache repository.UserCacheRepo
Store repository.Store
Emails OwnerEmailReader
Notify Notifier
}
Deps declares the subdomain's dependencies; the module facade forwards them from the composition root.
type Notifier ¶
type Notifier interface {
NotifySubscriptionExpired(ctx context.Context, email string, expiredAt time.Time)
NotifyTrafficExceeded(ctx context.Context, email string)
}
Notifier delivers the lifecycle notices to the subscription owner. The composition root adapts it to the notification queue until a notification facade owns email delivery.
type OwnerEmailReader ¶
type OwnerEmailReader interface {
FindUserAuthMethodByUserId(ctx context.Context, method string, userId int64) (*user.AuthMethods, error)
}
OwnerEmailReader is the read-only identity port resolving a user's email binding; the legacy user-auth repository satisfies it structurally.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the lifecycle-sweep entry point used by the subscription facade.
func NewService ¶
func (*Service) CheckSubscriptions ¶
CheckSubscriptions runs both lifecycle sweeps. Each sweep commits its status flip in a subscription-domain transaction; notifications and cache invalidation are retryable side effects that run after the commit (ADR-001 step 2).