Skip to content

Cleanup #43

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

Merged
merged 3 commits into from
Jun 5, 2025
Merged

Cleanup #43

merged 3 commits into from
Jun 5, 2025

Conversation

max-ostapenko
Copy link
Contributor

@max-ostapenko max-ostapenko commented Jun 5, 2025

This pull request refactors multiple controllers in the codebase to streamline query execution and reduce redundancy. It introduces a generic report controller factory for handling similar operations across different data types and replaces custom query handling logic with shared utilities. The changes improve maintainability by consolidating repetitive code into reusable components.

Consolidation of Controllers:

  • Generic Report Controller Factory: Added createReportController in src/controllers/reportController.js to handle common functionality for adoption, pageWeight, lighthouse, and core_web_vitals data. This eliminates the need for individual implementations of these controllers.

Refactoring Controllers to Use Shared Utilities:

  • Categories Controller: Refactored listCategories in src/controllers/categoriesController.js to use executeQuery and validateArrayParameter utilities, simplifying query building and data processing.
  • Geos Controller: Updated listGeos in src/controllers/geosController.js to use the executeQuery utility, removing custom cache handling logic.
  • Ranks Controller: Refactored listRanks in src/controllers/ranksController.js to use the executeQuery utility, streamlining query execution.

Removal of Redundant Code:

  • Controller Cleanup: Removed individual implementations for listAdoptionData, listPageWeightData, listLighthouseData, and listCWVTechData in their respective files (adoptionController.js, pageWeightController.js, lighthouseController.js, cwvtechController.js) as they are now handled by the generic report controller. [1] [2] [3] [4]

@max-ostapenko max-ostapenko merged commit 9c6599e into main Jun 5, 2025
3 checks passed
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.

1 participant