feat(go): M6.6 — /qr, /sync-bank, /flush-cache, /version pages #32

Merged
kacerr merged 1 commits from feat/go-m6-6-action-pages into main 2026-05-08 14:54:17 +02:00
Owner

Summary

  • GET /qr — Czech QR Platba PNG endpoint; ports Python's qr_code() exactly: account validation (^[A-Z]{2}\d{2,34}$|^\d{1,16}/\d{4}$), amount clamping [0, 10M], * stripping, SPD string format. New dep: github.com/skip2/go-qrcode.
  • GET /sync-bank — runs Fio sync → infer payments for the current year, captures output into the sync.tmpl page with a success/error banner. Wired via web.ActionHandlers{BankSync} closure in serverCmd, which also calls FlushCache after a successful run.
  • GET /flush-cache + POST /flush-cache — confirmation form (GET) + action (POST) that deletes cache files and shows the deleted count.
  • GET /version — JSON alias of /api/version (Python parity; same {tag, commit, build_date} shape).
  • FlushCache() (int, error) added to membership.Sources interface; implemented on realSources via cache.FileCache.Flush(); stubbed on all test fakes.
  • 15 new tests: TestQRBuildSPD (9 table cases), TestServeQR, TestServeFlushCacheGET, TestServeFlushCachePOST, TestServeSync, TestServeVersion.

Test plan

  • cd go && go test ./... — all green
  • go run ./cmd/fuj server → open http://localhost:8080
  • /adults → click Pay on an unpaid month → modal shows QR image; scan with a Czech banking app
  • Direct: /qr?account=2702008874/2010&amount=700&message=Test → PNG renders
  • Nav → Sync Bank Data → page shows captured log + green banner
  • Nav → Flush Cache → button → success banner with file count
  • /version in browser → JSON {tag, commit, build_date}
  • /api/version still returns identical JSON (parity check)
  • Adults / juniors / payments still render without regressions

🤖 Generated with Claude Code

## Summary - **`GET /qr`** — Czech QR Platba PNG endpoint; ports Python's `qr_code()` exactly: account validation (`^[A-Z]{2}\d{2,34}$|^\d{1,16}/\d{4}$`), amount clamping `[0, 10M]`, `*` stripping, SPD string format. New dep: `github.com/skip2/go-qrcode`. - **`GET /sync-bank`** — runs Fio sync → infer payments for the current year, captures output into the `sync.tmpl` page with a success/error banner. Wired via `web.ActionHandlers{BankSync}` closure in `serverCmd`, which also calls `FlushCache` after a successful run. - **`GET /flush-cache` + `POST /flush-cache`** — confirmation form (GET) + action (POST) that deletes cache files and shows the deleted count. - **`GET /version`** — JSON alias of `/api/version` (Python parity; same `{tag, commit, build_date}` shape). - **`FlushCache() (int, error)`** added to `membership.Sources` interface; implemented on `realSources` via `cache.FileCache.Flush()`; stubbed on all test fakes. - **15 new tests**: `TestQRBuildSPD` (9 table cases), `TestServeQR`, `TestServeFlushCacheGET`, `TestServeFlushCachePOST`, `TestServeSync`, `TestServeVersion`. ## Test plan - [ ] `cd go && go test ./...` — all green - [ ] `go run ./cmd/fuj server` → open http://localhost:8080 - [ ] `/adults` → click **Pay** on an unpaid month → modal shows QR image; scan with a Czech banking app - [ ] Direct: `/qr?account=2702008874/2010&amount=700&message=Test` → PNG renders - [ ] Nav → **Sync Bank Data** → page shows captured log + green banner - [ ] Nav → **Flush Cache** → button → success banner with file count - [ ] `/version` in browser → JSON `{tag, commit, build_date}` - [ ] `/api/version` still returns identical JSON (parity check) - [ ] Adults / juniors / payments still render without regressions 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kacerr added 1 commit 2026-05-08 14:30:54 +02:00
feat(go): M6.6 — /qr, /sync-bank, /flush-cache, /version pages
All checks were successful
Deploy to K8s / deploy (push) Successful in 8s
fe935235e8
- 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>
kacerr merged commit f6ba85b18f into main 2026-05-08 14:54:17 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kacerr/fuj-management#32