Skip to content

accounts: Add CreditAccount & DebitAccount sql queries #982

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

Conversation

ViktorTigerstrom
Copy link
Contributor

@ViktorTigerstrom ViktorTigerstrom commented Feb 18, 2025

This PR introduces separate CreditAccount and DebitAccount queries for the SQL database. The change encourages increasing the balance by a specific amount rather than setting it directly.

@ViktorTigerstrom ViktorTigerstrom added the no-changelog This PR is does not require a release notes entry label Feb 18, 2025
This commit adds a separate `CreditAccount` query to the sql db, to
incentivize not setting the balance directly, but rather instead
increase and decrease the balance by a specific amount.

We also update the sql store to use the new query function, instead of
setting the balance directly.
@ViktorTigerstrom ViktorTigerstrom force-pushed the 2025-02-credit-account-sql-query branch from 44ae7e0 to e20bf18 Compare March 18, 2025 09:25
@ViktorTigerstrom ViktorTigerstrom changed the title accounts: Add CreditAccount sql query accounts: Add CreditAccount & DebitAccount sql queries Mar 18, 2025
Copy link
Contributor

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

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

Nice, have just some comments 👍

This commit adds a separate `DebitAccount` query to the sql db, to
incentivize not setting the balance directly, but rather instead
increase and decrease the balance by a specific amount.

We also update the sql store to use the new query function, instead of
setting the balance directly.
@ViktorTigerstrom ViktorTigerstrom force-pushed the 2025-02-credit-account-sql-query branch from e20bf18 to 46bc3c0 Compare March 19, 2025 11:07
Copy link
Contributor

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@ellemouton
Copy link
Member

I think I dont quite follow the motivation for this change?

in my mind the DB CRUD layer should be just that and then any business logic should be on a code layer above. Having the addition/subtraction on the code layer also allows us to do extra validation etc (more business logic) before performing any DB commits.

@lightninglabs-deploy
Copy link

@ellemouton: review reminder

@ViktorTigerstrom
Copy link
Contributor Author

We decided offline to not proceed with this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog This PR is does not require a release notes entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants