alby-hub/api
René Aaron ed7e10cf25
feat: user labels for transactions (#2265)
* feat: user labels poc

* feat: backend for transaction user labels

Add PATCH /api/transactions/:paymentHash/label that merges a
user-supplied {key:value} map into the existing transaction metadata
under the user_label key, preserving NIP-47 fields. Empty map clears
the labels. Trims whitespace, drops blank rows, caps key/value length.

Wire the frontend editor to call the endpoint and revalidate the
transactions SWR cache on success.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: include user labels as columns in CSV export

Collect the union of user_label keys across all exported transactions
and emit each one as its own label_<key> column. The existing metadata
JSON column is preserved so importers like Raccoin keep working.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: drop hardcoded label suggestions, autocomplete from prior keys

Open the editor with a single blank row instead of four pre-seeded
fields. Suggest label keys via a datalist populated from any
user_label keys already present in the SWR transactions cache, so
suggestions reflect the user's own taxonomy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: inline label editor and indicator-only list row

Replace the nested label dialog with an inline editor that toggles
within the existing transaction detail dialog, removing dialog
stacking. In the transactions list, replace per-label badges with a
single tag icon next to the timestamp so row height stays uniform; the
full labels remain visible in the detail view.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: don't bump updated_at on metadata-only edits

GORM's Update auto-touches updated_at, which made the transactions
list reorder labeled transactions to the top. Switch
SetTransactionMetadata to UpdateColumn so only the metadata column
changes. Add regression test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: route PATCH transaction label requests in wails

The desktop app routes API calls through WailsRequestRouter rather
than HTTP. Add a handler for PATCH /api/transactions/:hash/label
before the existing transaction lookup so labels work in Wails too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: finalize backend

* chore: rename to labels

* chore: finalize frontend

* chore: use tx id to add user labels

* chore: address minor nits

* fix: linting

* fix: use explicit primary key lookups

* chore: simplify transaction csv label export

* fix(frontend): drop label count from transaction list badge

The count adds visual weight without informing any decision from the
list view. The icon-as-badge already signals labels exist; the actual
values are in the details dialog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(frontend): revert transaction list label indicator to bare icon

The Badge wrapper made the icon-only indicator wider than tall, which
looked off. Restores the pre-PR look — a small TagIcon next to the
timestamp — since the in-dialog editor is the place to see actual labels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: im-adithya <imadithyavardhan@gmail.com>
2026-04-30 13:13:07 +02:00
..
api.go fix: use file paths instead of hex during LND onboarding (#2231) 2026-04-21 22:33:25 +05:30
api_test.go feat: proposal: custom node commands (#1007) 2025-01-30 18:20:17 +07:00
apps_test.go Feat: NWA auth for self-hosted hubs (#1016) 2025-02-27 19:12:55 +07:00
backup.go fix: prevent LN client access during shutdown (#2096) 2026-02-27 15:45:09 +07:00
esplora.go Adding checks for ok status code in responses (#2178) 2026-03-31 23:21:26 +05:30
lsp.go feat: suffix balance/amount fields with explicit unit (Sat or Msat) (#2153) 2026-04-17 13:53:28 +05:30
models.go feat: user labels for transactions (#2265) 2026-04-30 13:13:07 +02:00
rebalance.go feat: suffix balance/amount fields with explicit unit (Sat or Msat) (#2153) 2026-04-17 13:53:28 +05:30
transactions.go feat: user labels for transactions (#2265) 2026-04-30 13:13:07 +02:00