-
Notifications
You must be signed in to change notification settings - Fork 4
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
[explorer/nodewatch]: Added query params for get node list endpoint #1303
base: nodewatch/add-node-api-status
Are you sure you want to change the base?
Conversation
e16e99b
to
30afd3e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## nodewatch/add-node-api-status #1303 +/- ##
=================================================================
- Coverage 98.24% 98.24% -0.01%
=================================================================
Files 158 158
Lines 6571 6592 +21
Branches 143 143
=================================================================
+ Hits 6456 6476 +20
- Misses 115 116 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
role_condition = True | ||
|
||
if role is not None: | ||
role_condition = role == descriptor.roles if exact_match else role == (role & descriptor.roles) |
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.
If the roles does not match, it seems you can return False
role_condition = role == descriptor.roles if exact_match else role == (role & descriptor.roles) | ||
|
||
if only_ssl: | ||
return role_condition and descriptor.is_ssl_enabled |
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.
Should be able to do this return descriptor.is_ssl_enabled if only_ssl else True
def _get_json_nodes(role, exact_match, request_args): | ||
only_ssl = None | ||
if 'only_ssl' in request_args: | ||
only_ssl = True |
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.
only_ssl = True if 'only_ssl' in request_args else None
limit = int(request_args.get('limit', 0)) | ||
|
||
return jsonify(symbol_routes_facade.json_nodes(role=role, exact_match=exact_match, only_ssl=only_ssl, limit=limit, order=order)) | ||
|
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.
It seems role
is always a required arg?
Problem: The filter node is missing on the API node list endpoint.
Solution: Added query params
only_ssl
,limit
, andorder
.only_ssl
: to filter out SSL enable node, it needs explorer and wallet.limit
: the number of numbers returned from the endpoint.order
: shuffle node list when required