Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): Add GET /api/v1/wallet_transactions/:id endpoint #3119

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

julienbourdeau
Copy link
Contributor

@julienbourdeau julienbourdeau commented Jan 29, 2025

Context

We have multiple endpoints to get/update wallets and their transactions but an endpoint to get a wallet transaction by id was missing.

Wallets

  POST /wallets
  PUT  /wallets/{lago_id} 
  DEL  /wallets/{lago_id}
  GET  / wallets
  GET  / wallets/{lago_id}
  GET  /wallets/{lago_id}/wallet_transactions

Wallet Transactions

  POST /wallets_transactions
+ GET /wallets_transactions/{lago_id}

Description

This new endpoint allows you to retrieve a wallet transaction.

Alternatively, we could have an endpoint nested under wallet, /wallets/:id/wallet_transactions/:wt_id but I think it's less consistant with our API.

The query in the controller:

SELECT
	"wallet_transactions".*
FROM
	"wallet_transactions"
	INNER JOIN "wallets" ON "wallet_transactions"."wallet_id" = "wallets"."id"
	INNER JOIN "customers" ON "wallets"."customer_id" = "customers"."id"
WHERE
	"customers"."deleted_at" IS NULL
	AND "customers"."organization_id" = 'e3f46553-726d-4948-96be-2eab7a84caab'
	AND "wallet_transactions"."id" = '5186bfda-8d8f-4a32-8ab5-cb0f42c7271d'
LIMIT
	1

CleanShot 2025-01-29 at 17 46 03@2x
CleanShot 2025-01-29 at 17 46 25@2x

@julienbourdeau julienbourdeau self-assigned this Jan 29, 2025
Copy link

@michaelponrajah michaelponrajah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add it to the OpenApi?

@julienbourdeau
Copy link
Contributor Author

Yes, of course 👍

@julienbourdeau julienbourdeau merged commit 76e05ed into main Jan 30, 2025
6 checks passed
@julienbourdeau julienbourdeau deleted the feat/get-wt-endpoint branch January 30, 2025 14:24
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.

3 participants