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(robot-server): add protocol_kind query arg to GET protocols endpoint. #15589

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

vegano1
Copy link
Contributor

@vegano1 vegano1 commented Jul 6, 2024

Overview

The client app needs to filter out protocols based on their kind, this pull request allows that at the server side by adding a protocolKind query arg to the GET /protocols endpoint.

Closes: PLAT-330

Test Plan

  • Make sure that omitting the 'protocolKind' query arg returns ALL protocols
  • Make sure that only standard protocols are returned when protocolKind=standard
  • Make sure that only quick-transfer protocols are returned when protocolKind=quick-transfer
  • Make sure that we return a 400 when the protocolKind is invalid

Changelog

  • Add protocolKind query arg to the GET /protocols endpoint

Review requests

Risk assessment

Low, unreleased feature

@vegano1 vegano1 requested a review from a team as a code owner July 6, 2024 18:47
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Looks good but I think the mention in the docstring is redundant

robot-server/robot_server/protocols/router.py Outdated Show resolved Hide resolved
robot-server/robot_server/protocols/router.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ahiuchingau ahiuchingau left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

TY!

robot-server/robot_server/protocols/router.py Show resolved Hide resolved
robot-server/robot_server/protocols/router.py Outdated Show resolved Hide resolved
@@ -453,6 +471,7 @@ async def get_protocols(
files=[ProtocolFile(name=f.path.name, role=f.role) for f in r.source.files],
)
for r in protocol_resources
if (protocol_kind in [None, r.protocol_kind])
Copy link
Contributor

@SyntaxColoring SyntaxColoring Jul 8, 2024

Choose a reason for hiding this comment

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

Can we move this filtering into SQL? i.e. add a protocol_kind parameter to ProtocolStore.get_all()?

This can happen in another PR if it needs to, but it's generally easier to fix stuff like this earlier rather than later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed in person and I think you mentioned you'll look into this in another PR.

Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to merge!

@@ -453,6 +471,7 @@ async def get_protocols(
files=[ProtocolFile(name=f.path.name, role=f.role) for f in r.source.files],
)
for r in protocol_resources
if (protocol_kind in [None, r.protocol_kind])
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed in person and I think you mentioned you'll look into this in another PR.

@vegano1 vegano1 merged commit deb34b0 into edge Jul 10, 2024
7 checks passed
@vegano1 vegano1 deleted the PLAT-330-get-quick-transfer-protocols branch July 10, 2024 13:06
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.

4 participants