-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add number disambiguation endpoint #805
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #805 +/- ##
==========================================
+ Coverage 94.88% 94.93% +0.05%
==========================================
Files 89 91 +2
Lines 3809 3852 +43
==========================================
+ Hits 3614 3657 +43
Misses 195 195 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple initial comments on this. Logic of the actual endpoint looks sound.
|
||
# TODO: Fix docs, maybe with custom install serializer? | ||
class DisambiguateInstallOrNetworkNumber(APIView): | ||
permission_classes = [HasDisambiguateNumberPermission] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about just letting anyone with read-only role or better use this instead of making a permission? Is there a service that needs least privilege?
if install_object and install_object.status == Install.InstallStatus.NN_REASSIGNED | ||
else None | ||
), | ||
"exact_match_nonrecycled_install": ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, I think it would be clearer to have exact_match_install
:
"exact_match_nonrecycled_install": ( | |
"exact_match_install": ( |
Adds a new API endpoint which aids in network/install number disambiguation. Given an ambiguous number, checks if it matches the NN for an existing node, and returns that node. If not, checks the given number as an install number and returns the attached node (if it exists).
Also returns fields to "show its work", which let you see what objects it found matching the requested number
Closes #801