feat(go): M6.6 — /qr, /sync-bank, /flush-cache, /version pages
All checks were successful
Deploy to K8s / deploy (push) Successful in 8s
All checks were successful
Deploy to K8s / deploy (push) Successful in 8s
- GET /qr: Czech QR Platba PNG; ports Python qr_code() exactly
(account validation, amount clamping, * stripping, SPD format)
- GET /sync-bank: Fio sync → infer → cache flush with captured log
- GET+POST /flush-cache: form + action, shows deleted count
- GET /version: JSON alias of /api/version (Python parity)
- FlushCache() added to membership.Sources; wired through api.Handler
- web.ActionHandlers{BankSync} closure-based dep injection for sync
- New dep: github.com/skip2/go-qrcode
- TestQRBuildSPD (9 cases), TestServeQR, TestServeFlushCache{GET,POST},
TestServeSync, TestServeVersion added
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -25,11 +25,17 @@ type ExceptionLoader interface {
|
||||
LoadExceptions(ctx context.Context) (map[reconcile.ExceptionKey]reconcile.Exception, error)
|
||||
}
|
||||
|
||||
// CacheFlusher can invalidate all cached data.
|
||||
type CacheFlusher interface {
|
||||
FlushCache() (int, error)
|
||||
}
|
||||
|
||||
// Sources is the aggregate interface required by ReconcileReport.
|
||||
type Sources interface {
|
||||
AttendanceLoader
|
||||
TransactionLoader
|
||||
ExceptionLoader
|
||||
CacheFlusher
|
||||
}
|
||||
|
||||
// NewStubSources returns a Sources whose every method returns ErrIOPending.
|
||||
@@ -52,3 +58,5 @@ func (stubSources) LoadTransactions(_ context.Context) ([]reconcile.Transaction,
|
||||
func (stubSources) LoadExceptions(_ context.Context) (map[reconcile.ExceptionKey]reconcile.Exception, error) {
|
||||
return nil, ErrIOPending
|
||||
}
|
||||
|
||||
func (stubSources) FlushCache() (int, error) { return 0, nil }
|
||||
|
||||
@@ -31,6 +31,8 @@ func (f fakeSources) LoadExceptions(_ context.Context) (map[reconcile.ExceptionK
|
||||
return f.exceptions, nil
|
||||
}
|
||||
|
||||
func (fakeSources) FlushCache() (int, error) { return 0, nil }
|
||||
|
||||
func TestReconcileReport(t *testing.T) {
|
||||
t.Parallel()
|
||||
s := fakeSources{
|
||||
|
||||
@@ -111,6 +111,9 @@ func (s *realSources) LoadTransactions(ctx context.Context) ([]reconcile.Transac
|
||||
return parseTransactionRows(rows)
|
||||
}
|
||||
|
||||
// FlushCache deletes all cached data files and resets in-memory cache state.
|
||||
func (s *realSources) FlushCache() (int, error) { return s.cache.Flush() }
|
||||
|
||||
// LoadExceptions fetches the exceptions tab (cached).
|
||||
func (s *realSources) LoadExceptions(ctx context.Context) (map[reconcile.ExceptionKey]reconcile.Exception, error) {
|
||||
rows, err := cache.Get(ctx, s.cache, "exceptions_dict",
|
||||
|
||||
Reference in New Issue
Block a user