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

Improve All Business Logics That Make More Than One DB Calls To Avoid Partial Data Insertions, Using DB Transactions. #1683

Closed
4 tasks
elraphty opened this issue Jun 6, 2024 · 0 comments · Fixed by #1684
Assignees

Comments

@elraphty
Copy link
Contributor

elraphty commented Jun 6, 2024

Context

Currently, we catch individual DB call errors, when we work on a business logic that requires more than one insert or update call, which may lead to partial database data.

e.g

p, err := oh.db.CreateOrEditWorkspaceRepository(workspaceRepo)
if err != nil {
    w.WriteHeader(HTTP.StatusBadRequest)
    return
}

we return out of process if any error is found.

Design

We want to use database transactions to perform such chain database calls, to avoid any partial data in the database.

These are the important business logic to look at:

  • MakeBountyPayment
  • WithdrawBudget
  • GenerateBudgetInvoice
  • GenerateInvoice
  • DeleteWorkspace
  • PollBudgetInvoices
  • PollUserWorkspacesBudge

Acceptance Criteria

  • I've tested on Chrome
  • I've created a test that...
  • I have rebased and tested locally before submitting my PR
  • I can submit a PR within 2 days of taking the bounty

Here is an example backend test

@elraphty elraphty self-assigned this Jun 6, 2024
@elraphty elraphty changed the title Improve All Business Logics That Make More Than One DB Calls Using Transactions Improve All Business Logics That Make More Than One DB Calls To Avoid Partial Data Insertions, Using DB Transactions. Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant