Documentation
¶
Overview ¶
Package worker starts the background job runner and registers all job handlers.
Index ¶
Constants ¶
const ( JobAccounting = "accounting" JobEmailReceipt = "email_receipt" JobStockAlert = "stock_alert" )
Job name constants — must match handler registrations in NewRunner.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountingPayload ¶
type AccountingPayload struct {
EventName string `json:"event_name"`
Payload map[string]any `json:"payload"`
}
AccountingPayload is the job body for accounting journal creation (Phase 8).
func (AccountingPayload) Kind ¶ added in v0.2.0
func (p AccountingPayload) Kind() string
Kind implements data.BackgroundJob.
type EmailReceiptPayload ¶
type EmailReceiptPayload struct {
OrderID string `json:"order_id"`
CompanyID string `json:"company_id"`
ReceiptNumber string `json:"receipt_number"`
Total int64 `json:"total"`
}
EmailReceiptPayload carries the minimum order info needed to send a receipt.
func (EmailReceiptPayload) Kind ¶ added in v0.2.0
func (p EmailReceiptPayload) Kind() string
Kind implements data.BackgroundJob.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner wraps a goqite jobs.Runner with all registered job handlers.
func NewRunner ¶
func NewRunner( q *goqite.Queue, log *slog.Logger, accountingSvc *accounting.Service, registry *plugin.Registry, ) *Runner
NewRunner creates a Runner with all job handlers registered. accountingSvc may be nil when the accounting repo is not configured (tests). registry may be nil if no plugin directory is configured.
type StockAlertPayload ¶
type StockAlertPayload struct {
ProductID string `json:"product_id"`
CompanyID string `json:"company_id"`
Quantity float64 `json:"quantity"`
ValueLost int64 `json:"value_lost"`
}
StockAlertPayload carries the product info emitted after a waste movement.
func (StockAlertPayload) Kind ¶ added in v0.2.0
func (p StockAlertPayload) Kind() string
Kind implements data.BackgroundJob.