Skip to content

Nest wallet endpoints under account resource#178

Merged
jwijgerd merged 4 commits into
mainfrom
copilot/update-wallet-api-endpoints
Nov 16, 2025
Merged

Nest wallet endpoints under account resource#178
jwijgerd merged 4 commits into
mainfrom
copilot/update-wallet-api-endpoints

Conversation

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor

Plan: Update Wallet API Endpoints to Use Account-Scoped Paths ✅ COMPLETE

Current State

  • Wallet endpoints are currently under /v1/wallets/{walletId}/...
  • Account endpoints are under /v1/accounts/{accountId}/...
  • Each accountId has exactly one wallet (wallet is created from AccountCreatedEvent)
  • WalletId is the same as accountId (userId)

Changes Required

  • Update WalletCommandController to use /v1/accounts/{accountId}/wallet path
    • Changed from /v1/wallets/{walletId}/balances/{currency}/credit to /v1/accounts/{accountId}/wallet/balances/{currency}/credit
    • Changed from /v1/wallets/{walletId}/balances to /v1/accounts/{accountId}/wallet/balances
  • Update WalletQueryController to use /v1/accounts/{accountId}/wallet path
    • Changed from /v1/wallets/{walletId} to /v1/accounts/{accountId}/wallet
  • Update all tests in CryptoTradingCommandApiTest to use new endpoints
  • Update all tests in CryptoTradingQueryApiTest to use new endpoints
  • Update all tests in CryptoTradingE2ETests to use new endpoints
  • Verify code compiles successfully
  • Run tests to verify all changes work correctly

Test Results

✅ Code compiles successfully
✅ testCreateAccount - PASSED
✅ testCreateAccountAndCreditWallet - PASSED
✅ testCreateAccountAndAddBtcBalance - PASSED
✅ testCreateAccountAndCreditWalletWithoutBalance - PASSED

Summary

All changes have been successfully implemented and verified. The wallet API endpoints now use account-scoped paths (/v1/accounts/{accountId}/wallet/...) instead of separate wallet paths (/v1/wallets/{walletId}/...). This better reflects the domain model where each account has exactly one wallet.

Files Changed (5 files)

  1. WalletCommandController.java - Updated paths and renamed path variable
  2. WalletQueryController.java - Updated paths and renamed path variable
  3. CryptoTradingCommandApiTest.java - Updated test URIs
  4. CryptoTradingQueryApiTest.java - Updated test URIs
  5. CryptoTradingE2ETests.java - Updated E2E test URIs

Note: Only REST API layer changed; no modifications to Aggregates, Commands, Events, or domain logic.

Original prompt

for the crypto-trading test app we currently have the wallet api endpoints under a separate path. However each accountId has exactly one wallet (the wallet is created based on the AccountCreated event). On the API controller layer, make the command and query api endpoints use /v1/accounts/${accountId}/wallet for the wallet endpoints. Only change the REST API layer not the Aggregates

Custom agent used: framework-developer
A Framework Developer for the Akces (Apacke Kafka CQRS Event Sourcing) Framework


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 16, 2025
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Copilot AI changed the title [WIP] Update wallet API endpoints to use account-specific path Nest wallet endpoints under account resource Nov 16, 2025
Copilot AI requested a review from jwijgerd November 16, 2025 20:59
@jwijgerd
jwijgerd marked this pull request as ready for review November 16, 2025 21:04
@jwijgerd

Copy link
Copy Markdown
Contributor

@copilot also update the CryptoTradingE2ETests

Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot also update the CryptoTradingE2ETests

Updated CryptoTradingE2ETests with the new account-scoped wallet endpoints in commit 1b95aca. All three wallet endpoint URIs have been changed:

  • /v1/wallets/{userId}/balances/v1/accounts/{userId}/wallet/balances
  • /v1/wallets/{userId}/balances/EUR/credit/v1/accounts/{userId}/wallet/balances/EUR/credit
  • /v1/wallets/{userId}/v1/accounts/{userId}/wallet

@jwijgerd
jwijgerd merged commit 60f853b into main Nov 16, 2025
5 checks passed
@jwijgerd
jwijgerd deleted the copilot/update-wallet-api-endpoints branch November 16, 2025 21:26
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