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

Seperate API calls from handling datastructures logic #3

Merged
merged 9 commits into from
Jul 14, 2022

Conversation

rosesyrett
Copy link
Contributor

created folder to contain logic of handling API calls, to separate this from actual API calls in routes/.

Currently this feels a bit pointless, as I don't have a database to connect to. However in future, if I am needing to interact with a database for example, this could be a great help as database specific functions can go in controllers/ and not clutter anything in routes/.

Additionally, I tried to make it very clear what the dependencies are for each APIRoute instance - unpickleHKl and pickleHkl. In future, these will be removed or replaced and instead a middleware for a db connection will be added.

Copy link
Collaborator

@callumforrester callumforrester 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, a few general comments:

  • There's a mix of sync and async code, we should deal with that in a separate PR
  • Persistence can also be more fully separated, again probably best to do that in another PR. Rough, untested example for a single endpoint here: https://github.com/RAYemelyanova/diffcalc_API/pull/4/files
  • What you've called controllers is often used to refer to what you've called routes, so I would name that module something different. Maybe services?

src/diffcalc_API/controllers/HklCalculation.py Outdated Show resolved Hide resolved
@rosesyrett rosesyrett dismissed callumforrester’s stale review July 14, 2022 11:03

I have made the requested changes and am going to make 2 new PRs to address asaync/sync issues and persistence.

@rosesyrett rosesyrett merged commit fc51929 into master Jul 14, 2022
@rosesyrett rosesyrett deleted the decoupleDataHandlingLogic branch July 14, 2022 11: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.

2 participants