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

feat: DuplicatePeer error #1848

Merged
merged 7 commits into from
Sep 13, 2023
Merged

feat: DuplicatePeer error #1848

merged 7 commits into from
Sep 13, 2023

Conversation

mkurapov
Copy link
Contributor

@mkurapov mkurapov commented Sep 11, 2023

Changes proposed in this pull request

  • Adds DuplicatePeer error during peering creation via checking for new unique constraint/index in the DB

Context

While building out the auto-peering service, I noticed that it didn't really make sense to allow creating a Peer with the same combination of staticIlpAddress and assetId (this would mean a duplicate peering relationship). This adds a unique constraint for these two columns in the DB.

Related to #1761

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Documentation added
  • Make sure that all checks pass
  • Postman collection updated

@netlify
Copy link

netlify bot commented Sep 11, 2023

Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit afa767f
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/6501821368f3b6000817bafb

@github-actions github-actions bot added type: tests Testing related pkg: backend Changes in the backend package. type: source Changes business logic labels Sep 11, 2023
@mkurapov mkurapov changed the title Mk/1761/duplicate peer feat: DuplicatePeer error Sep 11, 2023
@mkurapov mkurapov marked this pull request as ready for review September 12, 2023 11:33
BlairCurrey
BlairCurrey previously approved these changes Sep 13, 2023
Copy link
Contributor

@BlairCurrey BlairCurrey left a comment

Choose a reason for hiding this comment

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

Left a suggestion but looks good. Tested on postman as well and see the 409 duplicate peer error.

@@ -24,6 +26,7 @@ export const errorToMessage: {
[key in PeerError]: string
} = {
[PeerError.DuplicateIncomingToken]: 'duplicate incoming token',
[PeerError.DuplicatePeer]: 'duplicate peer',
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to provide a more specific error message rather than simply "Duplicate peer"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to be more specific

Copy link
Member

@sabineschaller sabineschaller left a comment

Choose a reason for hiding this comment

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

Thanks for making this so digestible.

@mkurapov mkurapov merged commit a087c5f into main Sep 13, 2023
25 checks passed
@mkurapov mkurapov deleted the mk/1761/duplicate-peer branch September 13, 2023 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: backend Changes in the backend package. type: source Changes business logic type: tests Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants