Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Fix attempting to create duplicate links resulting in an error being thrown #247

Merged
merged 2 commits into from
May 31, 2023

Conversation

KowalskiPiotr98
Copy link
Contributor

@KowalskiPiotr98 KowalskiPiotr98 commented May 31, 2023

This was happening because the LinkRepository was checking for duplicates using the Id field, even though the database was doing that by the url and user id fields.
Because of that, the database correctly detected the duplicate, but the repository didn't, thus throwing an unhandled error.

As a bonus this PR also adds a message being returned when duplicate link is being added.

Closes #246.

@sonarcloud
Copy link

sonarcloud bot commented May 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

75.0% 75.0% Coverage
0.0% 0.0% Duplication

@KowalskiPiotr98 KowalskiPiotr98 merged commit d129ea2 into main May 31, 2023
@KowalskiPiotr98 KowalskiPiotr98 deleted the link-duplication-fix branch May 31, 2023 18:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quick adding a duplicate link results in a bad behaviour
1 participant