api

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Overview

Package api provides the HTTP server and route wiring for Velox. It creates domain stores, services, and handlers, then mounts them on a chi router with auth, rate limiting, and metrics middleware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordSchedulerRun

func RecordSchedulerRun()

RecordSchedulerRun is called by the billing scheduler after each cycle so the health check can determine whether the scheduler is alive.

func SetSchedulerInterval

func SetSchedulerInterval(d time.Duration)

SetSchedulerInterval stores the configured scheduler interval so the health check knows when to flag it as degraded (>2x interval).

Types

type Server

type Server struct {

	// Exported for main.go to wire the billing scheduler + dunning
	BillingEngine    *billing.Engine
	DunningSvc       *dunning.Service
	SettingsStore    *tenant.SettingsStore
	WebhookOutSvc    *webhook.Service
	OutboxStore      *webhook.OutboxStore
	EmailOutboxStore *email.OutboxStore
	EmailSender      *email.Sender
	// EmailSettledChecker feeds the email dispatcher's staleness gate
	// (cmd/velox wires it via SetSettledChecker): action-required emails
	// whose invoice settled while queued are skipped, not delivered.
	EmailSettledChecker email.InvoiceSettledChecker
	CreditSvc           *credit.Service
	InvoiceSvc          *invoice.Service
	CreditNoteSvc       *creditnote.Service
	SubscriptionSvc     *subscription.Service
	TokenSvc            *payment.TokenService
	PaymentReconciler   *payment.Reconciler

	// TestClockSvc lets main.go wire the async catchup queue + worker
	// (per ADR-015 — Stripe-style async test-clock advance) and run
	// boot recovery for any clocks left in 'advancing' from a prior
	// process. Construction is here in router.go, lifecycle is in
	// main.go alongside the rest of the background workers.
	TestClockSvc *testclock.Service
	// contains filtered or unexported fields
}

func NewServer

func NewServer(db *postgres.DB, clk clock.Clock) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.
Package middleware provides HTTP middleware for the Velox API server.
Package middleware provides HTTP middleware for the Velox API server.
Package timefilter is the shared parser for ?from / ?to (and named variants like ?date_from / ?date_to) query parameters across operator-facing list and export endpoints.
Package timefilter is the shared parser for ?from / ?to (and named variants like ?date_from / ?date_to) query parameters across operator-facing list and export endpoints.

Jump to

Keyboard shortcuts

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