jobs

package
v0.0.1-0...-104a2d1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankSyncJob

type BankSyncJob struct {
	UserID       uuid.UUID `json:"user_id"`
	ConnectionID uuid.UUID `json:"connection_id"`
	SyncType     string    `json:"sync_type"` // "full" or "incremental"
}

func (BankSyncJob) Kind

func (BankSyncJob) Kind() string

type BankSyncWorker

type BankSyncWorker struct {
	river.WorkerDefaults[BankSyncJob]
	// contains filtered or unexported fields
}

func (*BankSyncWorker) Work

func (w *BankSyncWorker) Work(ctx context.Context, job *river.Job[BankSyncJob]) error

After adding an account, start a sync job that sync accounts & transactions for that connection then schedule a sync every day

type BankSyncWorkerDeps

type BankSyncWorkerDeps struct {
	DB             *pgxpool.Pool
	Queries        *repository.Queries
	FinanceManager *finance.ProviderManager
	Logger         *zerolog.Logger
}

type EmailJob

type EmailJob struct {
	UserID    int64          `json:"user_id"`
	Email     string         `json:"email"`
	Template  string         `json:"template"`
	Variables map[string]any `json:"variables"`
}

func (EmailJob) Kind

func (EmailJob) Kind() string

type EmailWorker

type EmailWorker struct {
	river.WorkerDefaults[EmailJob]
	// contains filtered or unexported fields
}

func (*EmailWorker) Work

func (w *EmailWorker) Work(ctx context.Context, job *river.Job[EmailJob]) error

type ExchangeRatesSyncJob

type ExchangeRatesSyncJob struct {
	JobDate time.Time `json:"job_date"`
}

func (ExchangeRatesSyncJob) Kind

type ExchangeRatesSyncWorker

type ExchangeRatesSyncWorker struct {
	river.WorkerDefaults[ExchangeRatesSyncJob]
	// contains filtered or unexported fields
}

func (*ExchangeRatesSyncWorker) NextRetry

NextRetry determines when to retry a failed job (1h here)

func (*ExchangeRatesSyncWorker) Timeout

Timeout returns how long the job can run before timing out (10 min here)

func (*ExchangeRatesSyncWorker) Work

type ExchangeRatesWorkerDeps

type ExchangeRatesWorkerDeps struct {
	DB      *pgxpool.Pool
	Queries *repository.Queries
	Logger  *zerolog.Logger
}

type ExportJob

type ExportJob struct {
	UserID     int64  `json:"user_id"`
	ExportType string `json:"export_type"` // "csv", "pdf", etc.
	DateRange  struct {
		From time.Time `json:"from"`
		To   time.Time `json:"to"`
	} `json:"date_range"`
}

func (ExportJob) Kind

func (ExportJob) Kind() string

type ExportWorker

type ExportWorker struct {
	river.WorkerDefaults[ExportJob]
	// contains filtered or unexported fields
}

func (*ExportWorker) Work

func (w *ExportWorker) Work(ctx context.Context, job *river.Job[ExportJob]) error

type HistoricalExchangeRateJob

type HistoricalExchangeRateJob struct {
	BaseCurrency string    `json:"base_currency"`
	StartDate    time.Time `json:"start_date"`
	EndDate      time.Time `json:"end_date"`
}

Historical Exchange Rate Job for backfilling data

func (HistoricalExchangeRateJob) Kind

type HistoricalExchangeRateWorker

type HistoricalExchangeRateWorker struct {
	river.WorkerDefaults[HistoricalExchangeRateJob]
	// contains filtered or unexported fields
}

func (*HistoricalExchangeRateWorker) Work

type Service

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

Job Service

func NewService

func NewService(db *pgxpool.Pool, logger *zerolog.Logger, openfinance *finance.ProviderManager) (*Service, error)

func (*Service) EnqueueBankSync

func (s *Service) EnqueueBankSync(ctx context.Context, userID, connectionID uuid.UUID, syncType string) error

func (*Service) EnqueueEmail

func (s *Service) EnqueueEmail(ctx context.Context, userID int64, email, template string, variables map[string]any) error

Job enqueueing methods

func (*Service) EnqueueExchangeRatesSync

func (s *Service) EnqueueExchangeRatesSync(ctx context.Context, jobDate time.Time) error

Bulk exchange rate sync methods

func (*Service) EnqueueExport

func (s *Service) EnqueueExport(ctx context.Context, userID int64, exportType string, from, to time.Time) error

func (*Service) EnqueueHistoricalExchangeRateUpdate

func (s *Service) EnqueueHistoricalExchangeRateUpdate(ctx context.Context, baseCurrency string, startDate, endDate time.Time) error

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

func (*Service) UpdateAllExchangeRates

func (s *Service) UpdateAllExchangeRates(ctx context.Context) error

Method to trigger immediate exchange rate update for all currencies

Jump to

Keyboard shortcuts

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