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

fix(api): refactor utility functions to detangle dependencies and reduce coupling #1189

Merged
merged 14 commits into from
Sep 1, 2024

Conversation

ollibowers
Copy link
Collaborator

@ollibowers ollibowers commented Aug 22, 2024

goals:

  • aiming to remove circular dependencies
  • extract out common functionality and remove dependency on the api route functions themselves
  • refactor file structure of routers slightly to make this pretty and clean
  • only two circular dep left (related to a legacy model PlannerData that is currently in progress of removal)

main changes:

  • server/routers/auth_utility/ -> server/routers/utility/
  • server/routers/utility.py -> server/routers/utility/common.py (advice appreciated on this new file name)
  • bunch of shared helpers moved into utility/common.py
  • moved user helpers out into own utility file
  • some router bodies abstracted into helpers to drop reliance on router funcs
  • decent refactor of setup-degree-wizard route body to be abit cleaner

@ollibowers ollibowers marked this pull request as ready for review August 24, 2024 14:07
@ollibowers ollibowers requested a review from a team as a code owner August 24, 2024 14:07
Copy link
Contributor

@martanman martanman left a comment

Choose a reason for hiding this comment

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

lgtm

@ollibowers ollibowers merged commit f243acc into 331-staging Sep 1, 2024
8 checks passed
@ollibowers ollibowers deleted the feat/api/refactor-api-helpers branch September 1, 2024 05:41
@ollibowers ollibowers linked an issue Sep 1, 2024 that may be closed by this pull request
justjo3l pushed a commit that referenced this pull request Sep 20, 2024
…uce coupling (#1189)

* refactor(utility): removed reliance on get_course route function, created get_course_details in utility.py

* refactor(utility): created term offering helpers to remove reliance on terms_offered route function

* refactor(utility): created specialisation getter, refactored setupDegreeWizard to not rely on route functions

* refactor(utility): created get_program_structure utility and moved out all dependencies from program routers

* refactor(utility): moved out regex_search to utility.py

* wip: move out user helpers into their own file

* refactor(utility): moved out logic for  and some graph helpers into utility.py

* fix: switched up setup_degree_wizard so we can get a bit better type inference

* fix: new line at end of user.py

* fix: remove unused CODE_MAPPING cache constant

* refactor: routers folder structure - move middleware.py into sessions utility folder

* refactor: routers folder - rename auth_utility folder, move utility.py into it and rename

* refactor: routers folder - move manual_fixes into utility folder

* fix: remove my todo list
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.

refactor utility functions and remove user data underwriters
2 participants