Skip to content

Conversation

@TaprootFreak
Copy link
Contributor

Summary

  • Previous migration addDebugWalletAdmin1769518555000 ran before wallet was registered
  • UPDATE affected 0 rows because wallet didn't exist yet
  • This retry migration applies the same UPDATE now that wallet exists

Test plan

  • Verify migration runs on deployment
  • Check wallet role is set to Debug after deployment

Add GET /support/swaps endpoint to expose swap statistics without authentication.

Features:
- Query all swap types (chain, submarine, reverse)
- Filter by type, pair, direction, status
- Returns aggregated stats (total, claimed, expired, refunded, pending, failed)
- Returns detailed swap list with source/destination info

New files:
- swap-stats.dto.ts: DTOs for query params and response

Modified:
- support.service.ts: Added getSwapStats() with fetch/map methods
- support.controller.ts: Added public GET endpoint
- Wrap DB queries in try-catch with proper error logging
- Fix sorting to handle invalid dates (NaN fallback to 0)
- Fix toIsoString: handle objects safely, support numeric timestamps
- Reduce cognitive complexity: extract matchesStatusFilter method
- Use pattern lookup instead of switch statement
- Add optional chaining (?.) in stats calculations
- Add nullish coalescing (?? '') in map functions
- Prevent TypeError when DB returns NULL status
Previous migration ran before wallet was registered, so UPDATE affected 0 rows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants