An application allowing users to explore, create, annotate, and share extensions of the MITRE ATT&CK® knowledge base. This repository contains the REST API service for storing, querying, and editing ATT&CK objects.
Refactor campaignsService for Improved Structure and Asynchronicity
Description:
In line with our project-orion objectives, the following requirements should be addressed for the campaigns-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:
Decoupling Database Logic:
Remove all direct database operations from the service module.
Migrate these operations to a new repository/DAO module.
Exceptions Handling:
Implement the new exceptions module to handle errors.
Replace traditional error handling with our standardized custom error classes.
Callbacks to Promises:
Transition all existing callback handlers to Promises.
Use try-catch blocks and async/await notation for cleaner, more readable asynchronous code.
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.
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.
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.
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.
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.
Refactor
campaignsService
for Improved Structure and AsynchronicityDescription:
In line with our
project-orion
objectives, the following requirements should be addressed for thecampaigns-service.js
module. Please use the Matrices service and repository (services/matrices-service.js
andrepository/matrices-repository.js
) as a frame of reference when making these changes.Requirements:
Decoupling Database Logic:
Exceptions Handling:
Callbacks to Promises:
try-catch
blocks andasync/await
notation for cleaner, more readable asynchronous code.Service Structure:
BaseService
for consistent behavior and structure across all services.Repository Structure:
BaseRepository
to ensure consistency in database operations across services.Common Function Migration:
BaseRepository
andBaseService
as necessary.Service-Specific Functions:
BaseRepository
.Testing:
async/await
notation.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.