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

Refactor Software Service for Improved Structure and Asynchronicity #293

Closed
Tracked by #281
seansica opened this issue Sep 20, 2023 · 0 comments · Fixed by #339
Closed
Tracked by #281

Refactor Software Service for Improved Structure and Asynchronicity #293

seansica opened this issue Sep 20, 2023 · 0 comments · Fixed by #339
Assignees
Labels
enhancement New feature or request

Comments

@seansica
Copy link
Contributor

seansica commented Sep 20, 2023

Refactor softwareService for Improved Structure and Asynchronicity

Description:

In line with our project-orion objectives, the following requirements should be addressed for the software-service.js module. Please use the Matrices service and repository (services/matrices-service.js and repository/matrices-repository.js) as a frame of reference when making these changes.

Requirements:

  1. Decoupling Database Logic:

    • Remove all direct database operations from the service module.
    • Migrate these operations to a new repository/DAO module.
  2. Exceptions Handling:

    • Implement the new exceptions module to handle errors.
    • Replace traditional error handling with our standardized custom error classes.
  3. Callbacks to Promises:

    • Transition all existing callback handlers to Promises.
    • Use try-catch blocks and async/await notation for cleaner, more readable asynchronous code.
  4. Service Structure:

    • Refactor the service module to be a class-based structure.
    • This class should extend the BaseService for consistent behavior and structure across all services.
  5. Repository Structure:

    • The newly created repository/DAO should also be class-based.
    • This class should extend the BaseRepository to ensure consistency in database operations across services.
  6. Common Function Migration:

    • Migrate shared or common functions to BaseRepository and BaseService as necessary.
    • Avoid duplication and ensure that common functionalities are accessible to all services and repositories.
  7. Service-Specific Functions:

    • Functions that are specific to a particular service and are not shared should be implemented directly on the corresponding service class. Do not add them to BaseRepository.
  8. Testing:

    • Refactor the Mocha test suite spec file corresponding to this service.
    • Transition from callbacks to async/await notation.
    • Ensure all tests are passing before opening a pull request.

Notes:

Please reference any relevant documentation, discussions, or PRs as needed. Ensure that the refactoring remains consistent with the established practices from the Matrices service and repository as a reference.

@seansica seansica changed the title Refactor software-service Refactor Software Service for Improved Structure and Asynchronicity Sep 20, 2023
@seansica seansica added the enhancement New feature or request label Sep 20, 2023
@vsun757 vsun757 self-assigned this Sep 29, 2023
@ElJocko ElJocko linked a pull request Jan 24, 2024 that will close this issue
@ElJocko ElJocko closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants