handlers

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobTypeBackupLocal = "job_type_backup_local"
	ScopeDbBackup      = "sqlite_backup"
	StrategyVacuum     = "vacuum"
	StrategyOnline     = "online"
)
View Source
const JobTypeEmailChange = "job_type_email_change"
View Source
const JobTypeEmailVerification = "job_type_email_verification"
View Source
const JobTypeEmailVerificationOtp = "job_type_email_verification_otp"
View Source
const JobTypePasswordReset = "job_type_password_reset"

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailChangeHandler

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

EmailChangeHandler handles email change requests

func NewEmailChangeHandler

func NewEmailChangeHandler(dbAuth db.DbAuth, provider *config.Provider, mailer mail.MailerInterface) *EmailChangeHandler

NewEmailChangeHandler creates a new EmailChangeHandler

func (*EmailChangeHandler) Handle

func (h *EmailChangeHandler) Handle(ctx context.Context, job db.Job) error

Handle implements the JobHandler interface for email change requests

type EmailVerificationHandler

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

EmailVerificationHandler handles email verification jobs

func NewEmailVerificationHandler

func NewEmailVerificationHandler(dbAuth db.DbAuth, provider *config.Provider, mailer mail.MailerInterface) *EmailVerificationHandler

NewEmailVerificationHandler creates a new EmailVerificationHandler

func (*EmailVerificationHandler) Handle

func (h *EmailVerificationHandler) Handle(ctx context.Context, job db.Job) error

Handle implements the JobHandler interface for email verification

type EmailVerificationOtpHandler added in v0.10.0

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

EmailVerificationOtpHandler handles sending OTP emails

func NewEmailVerificationOtpHandler added in v0.10.0

func NewEmailVerificationOtpHandler(mailer mail.MailerInterface) *EmailVerificationOtpHandler

NewEmailVerificationOtpHandler creates a new handler

func (*EmailVerificationOtpHandler) Handle added in v0.10.0

func (h *EmailVerificationOtpHandler) Handle(ctx context.Context, job db.Job) error

Handle implements the JobHandler interface

type Handler

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

Handler handles database backup jobs

func NewHandler

func NewHandler(provider *config.Provider, logger *slog.Logger) *Handler

NewHandler creates a new Handler

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, job db.Job) error

Handle implements the JobHandler interface for database backups. It's a wrapper around the testable handle method.

type PasswordResetHandler

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

PasswordResetHandler handles password reset requests

func NewPasswordResetHandler

func NewPasswordResetHandler(dbAuth db.DbAuth, provider *config.Provider, mailer mail.MailerInterface) *PasswordResetHandler

NewPasswordResetHandler creates a new PasswordResetHandler

func (*PasswordResetHandler) Handle

func (h *PasswordResetHandler) Handle(ctx context.Context, job db.Job) error

Handle implements the JobHandler interface for password reset requests

type PayloadEmailChange

type PayloadEmailChange struct {
	UserID         string `json:"user_id"`
	CooldownBucket int    `json:"cooldown_bucket"`
}

type PayloadEmailChangeExtra

type PayloadEmailChangeExtra struct {
	NewEmail string `json:"new_email"`
}

type PayloadEmailVerification

type PayloadEmailVerification struct {
	Email string `json:"email"`
	// CooldownBucket is the time bucket number calculated from the current time divided by the cooldown duration.
	// This provides a basic rate limiting mechanism where only one email verification request is allowed per time bucket.
	// The bucket number is calculated as: floor(current Unix time / cooldown duration in seconds)
	CooldownBucket int `json:"cooldown_bucket"`
}

PayloadEmailVerification contains the email verification details

type PayloadEmailVerificationOtp added in v0.10.0

type PayloadEmailVerificationOtp struct {
	Email string `json:"email"`
	// CooldownBucket prevents rapid duplicate requests
	CooldownBucket int `json:"cooldown_bucket"`
}

PayloadEmailVerificationOtp contains the details for deduplicating queued email tasks

type PayloadEmailVerificationOtpExtra added in v0.10.0

type PayloadEmailVerificationOtpExtra struct {
	Otp string `json:"otp"`
}

PayloadEmailVerificationOtpExtra contains the unique OTP code data to act upon

type PayloadPasswordReset

type PayloadPasswordReset struct {
	UserID         string `json:"user_id"`
	CooldownBucket int    `json:"cooldown_bucket"`
}

type PayloadPasswordResetExtra

type PayloadPasswordResetExtra struct {
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

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