Skip to content

Feature/es6 controllers#56

Closed
agaesh wants to merge 29 commits intomainfrom
feature/es6-Controllers
Closed

Feature/es6 controllers#56
agaesh wants to merge 29 commits intomainfrom
feature/es6-Controllers

Conversation

@agaesh
Copy link
Owner

@agaesh agaesh commented Oct 9, 2025

🧩 Pull Request Title

feat(controllers): migrate all controllers to ES6 modules


📝 Description

This PR converts all existing controller files from CommonJS (require/module.exports) to ES6 module syntax (import/export) to align with modern JavaScript standards and improve maintainability.


Controllers Updated

  • DepartmentController.js
  • InstructorController.js
  • ProgramCourseController.js
  • UserController.js

🔄 Changes Made

  • Replaced require with import and module.exports with export syntax.
  • Implemented fileURLToPath for handling __dirname in ES modules.
  • Cleaned up unused imports and improved function naming consistency.
  • Standardized error handling and response formatting across all controllers.
  • Ensured model imports use proper initialization with sequelize and DataTypes.

🧠 Context

Part of the ES6 Migration Initiative to fully transition the backend architecture to modern ECMAScript standards for better compatibility with tools like Vite, Vitest, and ESLint.


🧪 Testing

  • Verified all routes for each controller are functional.
  • No breaking changes detected in response formats.
  • Successfully passed integration tests with database and services.

🚀 Next Steps

  • Proceed with ES6 conversion for Models and Services in separate PRs.
  • Update documentation and import paths in routes once all modules are migrated.

Would you like me to make a GitHub Issue description version of this too (to link with this PR)?

agaesh and others added 29 commits October 10, 2025 00:08
…se ES module syntax. error message handled properly
…se ES module syntax. error message handled properly
@agaesh agaesh self-assigned this Oct 10, 2025
@agaesh agaesh closed this Oct 10, 2025
@agaesh agaesh added the invalid This doesn't seem right label Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant