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: dedupe owners in upsert/patch asset #8

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Conversation

sudo-suhas
Copy link

  • Dedupe owners list based on ID, UUID and Email before calling the repository layer.
  • Dedupe owners list based on ID retrieved from DB using the UUID or Email in the repository layer.
  • Using the same transaction that is used to create a user for fetching user by UUID/Email to ensure consistent reads for ongoing transaction.
  • While patching an asset, carry over the user's UUID if present.
  • Add get-by-email/uuid with-transaction variants to user repository.

Closes #7

@sudo-suhas sudo-suhas requested a review from haveiss March 24, 2023 09:40
- Dedupe owners list based on ID, UUID and Email before calling the
  repository layer.
- Dedupe owners list based on ID retrieved from DB using the UUID or
  Email in the repository layer.
- Using the same transaction that is used to create a user for fetching
  user by UUID/Email to ensure consistent reads for ongoing
  transaction.
- While patching an asset, carry over the user's UUID if present.
- Add get-by-email/uuid with-transaction variants to user repository.
@coveralls
Copy link

coveralls commented Mar 24, 2023

Pull Request Test Coverage Report for Build 4509809853

  • 72 of 75 (96.0%) changed or added relevant lines in 4 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.09%) to 86.237%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/store/postgres/asset_repository.go 16 17 94.12%
internal/store/postgres/user_repository.go 29 31 93.55%
Files with Coverage Reduction New Missed Lines %
internal/store/postgres/user_repository.go 4 84.16%
Totals Coverage Status
Change from base Build 4509469872: 0.09%
Covered Lines: 5063
Relevant Lines: 5871

💛 - Coveralls

@sudo-suhas sudo-suhas merged commit ae42e30 into main Mar 28, 2023
@haveiss haveiss deleted the handle-dup-owner branch March 29, 2023 05:00
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.

Upserting an Asset returns 500 on duplicate owners
3 participants