classroom icon indicating copy to clipboard operation
classroom copied to clipboard

refactor: organize api_proccesor.js into domain-specific folders

Open CarlyAThomas opened this issue 11 months ago โ€ข 0 comments

Changes made:

  • Split monolithic 419-line api_proccesor.js into 14 organized files
  • Created domain folders: curriculum/, dashboard/, student/, legacy/
  • One function per file for better discoverability and maintainability
  • Updated imports in 6 files (components and pages)
  • No logic changes - pure organizational refactor
  • Original api_proccesor.js preserved for safety
  • Added visual documentation (mermaid.md) and refactor summary

Checklist:

There is not an associated issue for this PR.

Overview

Reorganized the monolithic util/api_proccesor.js (419 lines) into a clean, domain-specific folder structure with one function per file.

This is a pure refactor - no logic changes, only organizational improvements for better maintainability.

๐Ÿ“ New Structure

util/ โ”œโ”€โ”€ curriculum/ # Curriculum metadata & fetching (4 files) โ”œโ”€โ”€ dashboard/ # Dashboard data transformation (2 files) โ”œโ”€โ”€ student/ # Student progress & data (5 files) โ””โ”€โ”€ legacy/ # Deprecated v9-incompatible functions (3 files)

Total: 14 new organized files from 16 functions in the original monolithic file

See the mermaid diagram for a visual overview of the complete structure, dependencies, and imports.

โœ… Changes Made

  • Preserved: Original util/api_proccesor.js remains unchanged for safety
  • Created: Domain-specific folders with one function per file
  • Updated: Import statements in 6 files (components and pages)
  • Added: Documentation (REFACTOR_SUMMARY.md, mermaid.md)

Files Modified (Import Changes Only)

  1. components/DetailsDashboard.js
  2. components/DetailsDashboardList.js
  3. components/dashtable_v2.js
  4. pages/dashboard/[id].js
  5. pages/dashboard/v2/[id].js
  6. pages/dashboard/v2/details/[id]/[studentEmail].js

๐ŸŽฏ Benefits

  • Easy to Find: Go directly to the file you need instead of searching 419 lines
  • Clear Organization: Related functions grouped by domain
  • Better Maintainability: One function per file = easier to understand and modify
  • No Breaking Changes: Only import paths changed, all logic preserved

๐Ÿงช Testing

  • โœ… ESLint: No errors
  • โœ… Prettier: All files formatted
  • โœ… Import Resolution: All imports validated
  • โœ… No logic changes - pure organizational refactor

๐Ÿ“Š Visual Reference

See mermaid.md for an interactive diagram showing all organized folders, files, dependencies, and page imports.

CarlyAThomas avatar Dec 07 '25 03:12 CarlyAThomas