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

281 separate database logic from service layer #282

Merged
merged 52 commits into from
Sep 27, 2023

Conversation

seansica
Copy link
Contributor

@seansica seansica commented Aug 31, 2023

Closes #281

Description:

This pull request introduces a refactored version of one of the service layer modules. The changes serve as a proof of concept for the comprehensive refactoring approach we aim to adopt across all other services.

Key Changes:

  • Transitioned service layer to use classes instead of functions.
  • Abstracted shared/common functions to eliminate code duplication.
  • Introduced a dedicated exceptions module for enhanced error handling.
  • Decoupled database logic, migrating it to a dedicated repository (DAO) layer.
  • Transitioned from using callbacks to Promises.

Next Steps:

Developers should use the project-orion branch as a base for subsequent refactorings. Please ensure all new changes are modeled after this proof of concept to maintain consistency across services.

@seansica seansica changed the title 281 separate database logic from service layer Draft: 281 separate database logic from service layer Aug 31, 2023
@seansica seansica changed the base branch from develop to project-orion September 20, 2023 15:35
@seansica seansica marked this pull request as ready for review September 20, 2023 15:47
@seansica seansica changed the title Draft: 281 separate database logic from service layer 281 separate database logic from service layer Sep 20, 2023
@seansica seansica requested a review from ElJocko September 20, 2023 15:51
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 19 Code Smells

No Coverage information No Coverage information
6.4% 6.4% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 498 lines in your changes are missing coverage. Please review.

Files Coverage Δ
app/lib/attack-prefix-ids.js 100.00% <100.00%> (ø)
app/models/campaign-model.js 100.00% <100.00%> (ø)
app/models/collection-model.js 100.00% <100.00%> (ø)
app/models/data-component-model.js 100.00% <100.00%> (ø)
app/models/data-source-model.js 100.00% <100.00%> (ø)
app/models/group-model.js 100.00% <100.00%> (ø)
app/models/identity-model.js 100.00% <100.00%> (ø)
app/models/marking-definition-model.js 100.00% <100.00%> (ø)
app/models/matrix-model.js 100.00% <100.00%> (ø)
app/models/note-model.js 100.00% <100.00%> (ø)
... and 18 more

📢 Thoughts on this report? Let us know!.

@seansica
Copy link
Contributor Author

@ElJocko Changes since last review:

  • Refactor the save method
  • Move the pagination method to _base.service as a static method and delete the pagination module
  • Remove logger statements from service layer
  • Fix the failing static checks pipeline
  • Downgraded mongoose back to 6.12.0

This should be good to merge now.

@seansica seansica merged commit 02f9860 into project-orion Sep 27, 2023
2 of 5 checks passed
@seansica seansica deleted the 281-separate-database-logic-from-service-layer branch September 28, 2023 13:39
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