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

ensure only one key is deleted if multiple with same name #862

Merged
merged 4 commits into from Sep 22, 2023

Conversation

TylerNoblett
Copy link
Collaborator

Ensure that if there are multiple keys with the same name, only one is deleted

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@@ -16,7 +16,7 @@ func Map[T any, U any](slice []T, mapFn func(T) U) []U {
return result
}

// Find is a generic function that searches through a list searching for all items that match
// Filter is a generic function that searches through a list searching for all items that match
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops!

Copy link
Member

@jrozner jrozner left a comment

Choose a reason for hiding this comment

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

It looks like this would remove the first key rather than the one selected. I think it would make sense to either add a unique constraint on the name (so this problem doesn't exist) or swap out the identifier in the DELETE request to be a unique identifier (like we do with slugs) so that we can target them directly.

@TylerNoblett
Copy link
Collaborator Author

It looks like this would remove the first key rather than the one selected. I think it would make sense to either add a unique constraint on the name (so this problem doesn't exist) or swap out the identifier in the DELETE request to be a unique identifier (like we do with slugs) so that we can target them directly.

oh that's a good point - yeah I feel like the first one makes the most sense. I'll take a look

@TylerNoblett
Copy link
Collaborator Author

@jrozner we're now deleting based on the unique credential ID instead of the name

jkennedyvz
jkennedyvz previously approved these changes Jul 26, 2023
@TylerNoblett
Copy link
Collaborator Author

@jrozner @jkennedyvz I just added a check to ensure that the username is unique

@jrozner jrozner merged commit 9487bbd into main Sep 22, 2023
9 checks passed
@jrozner jrozner deleted the tn/only-delete-one-key branch September 22, 2023 19:07
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.

None yet

4 participants