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: RPC endpoints with typesafety #1155, #1156 #1145

Open
wants to merge 49 commits into
base: release-0.2.0
Choose a base branch
from

Conversation

kevin-hashimoto
Copy link
Collaborator

@kevin-hashimoto kevin-hashimoto commented Oct 31, 2024

  • feat: bring backend endpoint types to the frontend via openapi spec
  • refactor: convert hook files to type script and use new generated endpoint client
  • refactor: basic conversion of config files to ts
  • feat: add a file change watcher on the backend for dev to generate a new openapi.json file
  • refactor: to use 'Id' instead of 'ID' for consistency since we were using a mix of both
  • refactor: to always pass in an object to the custom hook param for consistency
  • refactor: to always use trycatch blocks
  • refactor: to type narrow and only type the parameters needed
  • refactor: to move ui related side effects from mutations out of custom hooks and into the mutate handler
  • refactor: to move query related side effects from mutations out of ui components and into the custom hook

closes #1155
closes #1156

Testing this PR

the best way to test this PR is probably to confirm each userflow and check if the features that involve the hooks work as expected.

context

When a file on the backend has changed, the backend watcher will generate a new openapi.json file. This openapi.json file is formatted in a standard spec that can be put through a generator to convert it into the necessary methods and types to use on the front end. Currently the frontend will need to manually run the generator via npm run openapi:generate but we are looking to incorporate a watcher that will watch the openapi.json file and run the generate script for full automation.

  • frontend service classes are generated via fastapi tags. All endpoints are nested in these service classes for organization.
  • There are a lot of hidden errors in the code if you convert a js file to ts - suggestion to slowly start converting files to ts/tsx to eliminate these errors for better reliability of code.

Reach out if you have any questions!

Copy link

github-actions bot commented Oct 31, 2024

Backend Test Results

431 tests  ±0   200 ✅  - 231   55s ⏱️ -37s
  1 suites ±0     0 💤 ±  0 
  1 files   ±0     0 ❌ ±  0   231 🔥 +231 

For more details on these errors, see this check.

Results for commit a231cbf. ± Comparison against base commit 66fbb2e.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Oct 31, 2024

Frontend Test Results

  1 files  ±0  115 suites  +1   39s ⏱️ +3s
362 tests  - 5  342 ✅  - 5  20 💤 ±0  0 ❌ ±0 
364 runs   - 5  344 ✅  - 5  20 💤 ±0  0 ❌ ±0 

Results for commit a231cbf. ± Comparison against base commit 66fbb2e.

♻️ This comment has been updated with latest results.

@kevin-hashimoto kevin-hashimoto marked this pull request as ready for review November 20, 2024 17:47
@kevin-hashimoto kevin-hashimoto changed the title Feat: RPC endpoints with typesafety Feat: RPC endpoints with typesafety #1155, #1156 Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants