Skip to content

Conversation

ViktorT-11
Copy link
Contributor

@ViktorT-11 ViktorT-11 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.

@ViktorT-11 ViktorT-11 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.
@ViktorT-11 ViktorT-11 force-pushed the 2025-02-credit-account-sql-query branch from 44ae7e0 to e20bf18 Compare March 18, 2025 09:25
@ViktorT-11 ViktorT-11 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.
@ViktorT-11 ViktorT-11 force-pushed the 2025-02-credit-account-sql-query branch from e20bf18 to 46bc3c0 Compare March 19, 2025 11:07
@ViktorT-11 ViktorT-11 requested a review from bitromortac March 19, 2025 12:03
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

@ViktorT-11
Copy link
Contributor Author

We decided offline to not proceed with this PR.

@ViktorT-11 ViktorT-11 closed this Apr 3, 2025
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