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

Feature/beacons backend #726

Merged
merged 9 commits into from
Jul 18, 2023
Merged

Feature/beacons backend #726

merged 9 commits into from
Jul 18, 2023

Conversation

aaronchongth
Copy link
Member

What's new

New backend for beacons

To test,

git clone https://github.com/open-rmf/rmf-web -b feature/beacons-backend
cd rmf-web
pnpm install

cd packages/api-server
source /opt/ros/humble/setup.bash # or any workspace with RMF if built from source, we just need rmf_api_msgs
pnpm start
# go to localhost:8000/docs to play with the API, create, get, get all

There will be a follow-up feature for the frontend

Self-checks

  • I have prototyped this new feature (if necessary) on Figma
  • I'm familiar with and follow this Typescript guideline
  • I added unit-tests for new components
  • I tried testing edge cases
  • I tested the behavior of the components that interact with the backend, with an e2e test

@aaronchongth aaronchongth requested a review from xiyuoh July 13, 2023 02:44
@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Merging #726 (9bc5112) into main (4634cc5) will increase coverage by 0.06%.
The diff coverage is 63.26%.

@@            Coverage Diff             @@
##             main     #726      +/-   ##
==========================================
+ Coverage   56.30%   56.37%   +0.06%     
==========================================
  Files         293      295       +2     
  Lines        6981     7028      +47     
  Branches      943      943              
==========================================
+ Hits         3931     3962      +31     
- Misses       2858     2874      +16     
  Partials      192      192              
Flag Coverage Δ
api-server 82.73% <63.26%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/api-server/api_server/rmf_io/__init__.py 100.00% <ø> (ø)
packages/api-server/api_server/routes/internal.py 80.26% <0.00%> (-2.17%) ⬇️
packages/api-server/api_server/routes/beacons.py 51.72% <51.72%> (ø)
...rver/api_server/models/tortoise_models/__init__.py 100.00% <100.00%> (ø)
...erver/api_server/models/tortoise_models/beacons.py 100.00% <100.00%> (ø)
packages/api-server/api_server/rmf_io/events.py 100.00% <100.00%> (ø)
packages/api-server/api_server/routes/__init__.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

async def get_beacon(beacon_id: str):
beacon_state = await ttm.BeaconState.get_or_none(id=beacon_id)
if beacon_state is None:
raise HTTPException(404, f"Beacon with ID {id} not found")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
raise HTTPException(404, f"Beacon with ID {id} not found")
raise HTTPException(404, f"Beacon with ID {beacon_id} not found")

Otherwise I am getting the following error if I submit a non-existent beacon ID:

{
  "detail": "Beacon with ID <built-in function id> not found"
}

Copy link
Member Author

Choose a reason for hiding this comment

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

done! 9bc5112, thanks for catching that

Signed-off-by: Aaron Chong <[email protected]>
@aaronchongth aaronchongth marked this pull request as ready for review July 18, 2023 02:47
@aaronchongth aaronchongth requested a review from xiyuoh July 18, 2023 02:48
Copy link
Member

@xiyuoh xiyuoh left a comment

Choose a reason for hiding this comment

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

LGTM!

@xiyuoh xiyuoh merged commit fd92cb3 into main Jul 18, 2023
@xiyuoh xiyuoh deleted the feature/beacons-backend branch July 18, 2023 13:56
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.

2 participants