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

fix(transaction): check transaction identifier #68

Merged
merged 4 commits into from
May 17, 2024

Conversation

shentschel
Copy link
Collaborator

  • check if transaction with identifier already exists
  • Return 409 conflict if transaction identifier already exists

Closes: #62

* check if transaction with identifier already exists
* Return 409 conflict if transaction identifier already exists

Closes: #62
Copy link
Contributor

@FreddyDevelop FreddyDevelop left a comment

Choose a reason for hiding this comment

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

Still get an Internal Server Error when trying to init a transaction with an already existing transactionId on a different user.
Current implementation only checks that the user has no transaction with the same id associated to it, but the database has a unique constraint on the transactionId and the tenantId: t.Index(["identifier", "tenant_id"], { "unique": true })

@shentschel
Copy link
Collaborator Author

How unique do we want to be with transaction ids? Should a transaction ID be unique per tenant or unique per tenant and user?

@FreddyDevelop
Copy link
Contributor

I think transactionIds should be unique per tenant.

Stefan Jacobi added 2 commits May 16, 2024 16:34
* the check now tries to fetch all transactions with a given identifier from a tenant before proceeding

Closes: #62
* add 409 error to transaction spec
* add description of unique transaction_id to spec

Closes: #62
add if transaction slice is bigger than 0

Co-authored-by: Frederic Jahn <[email protected]>
@FreddyDevelop FreddyDevelop merged commit e608ccd into main May 17, 2024
4 checks passed
@FreddyDevelop FreddyDevelop deleted the fix/62-check-transaction-id branch May 17, 2024 10:05
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.

Check transaction_id before storing it
2 participants