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

Refactoring most of the project #73

Merged
merged 100 commits into from
Oct 2, 2024
Merged

Conversation

ruslanbaidan
Copy link
Contributor

@ruslanbaidan ruslanbaidan commented Sep 11, 2024

The code refactoring includes the following parts:

  • Removed the relying on the abstraction and sharing the same methods execution of services.
  • Implemented the single responsibility approach to the entities.I
  • Added the filtering functionality to process the incoming get requests data and prepare them for the filter and sort queries.
  • Added the data validation at first place. Before the post, put, patch and delete requests data are passed to the services, they are validated.
  • Removed the dependency on the abstract table common methods, where the entities positions were processed, and some specific code run.
  • Implemented the common approach, not resources/time consuming, of the entities positioning based on interfaces and traits.
  • Optimised the export and import functionality to be clean and fast.
  • Added a common place to validate the analysis access and endpoints permissions before the controllers’ actions are reached. The Middleware passed an anr object to the actions automatically as an attribute.
  • Restructured the components and code parts of the application for the based on responsibilities, relations and to be more clear.
  • Removed many deprecated code parts and cleaned up the deprecated columns in the DB tables.
  • Improved some DB indexes and renamed tables, columns to be more clear on the names.
  • Added some first unit tests as a starting point for the full coverage.

Not refactored parts are the following: Questions, QuestionsChoices, Guide, Interviews, ROPA, Deliverable.

User stories.

  • Added possibility to export risk analysis with Knowledge Base (KB) and/or Assets Library (AL). That allows to optionally export all the KB a AL data without having the analysis modelling started. This is needed for sharing models between FrontOffices or update AL or KB with new versions of the structures.
  • Changed the export format of JSON export file to reduce its size and be similar to the api endpoints responses and the projects structures views. An old data converter is implemented for the backward compatibility.
  • Significantly improved the import time and made it always consistent. In case of import issues the data are not inserted, there are saved in the DB only at the end of the process (transactional approach).
  • Removed extra user’s information from password reset response and removed the endpoint access by the other users (points 5.1.1, 5.1.2).
  • Restricted analysis creation based on the models that are not available for the client by manually faking the request (point 5.2.3).

Ruslan Baidan and others added 30 commits November 8, 2021 14:04
…bstract

* origin/master:
  [Fix] Added the temporary method call to fix the anr creation from model with linked instances.
…bstract

* origin/master:
  [Fix] Renamed all the usages of recommandation, recommandationSet, and recommandationRisk tables properties names to recommendation
…bstract

* origin/master:
  Cleaned the use section.
  Fixed issue in string newlines in deliverables generation
…bstract

* origin/master:
  Removed the unused pre-commit hook.
  Fixed date format required in Front [md-datepicker]
…bstract

* origin/master: (43 commits)
  Fixed the table inheritance.
  FIxed the op risks creation without tag.
  CS fixes
  CS fixes
  apply previous patch
  CS fixes.
  CS fixes.
  Fixed the maping driver class namespace and cleaned the use sections.
  Updated doctrine orm module version.
  Updated the composer config.
  Fixed import SOA from another referential
  Fixed the styles.
  Removed the laminas coding standard.
  Test of phpcs validation on commit.
  Updated the files separator.
  Added the xml with the phpcs rules, test change for failign validation.
  Fixed the condition in the workflow.
  Fixed the condition this the workflow.
  Added the conditions to run only if changed.
  Test printing of files changes.
  ...

# Conflicts:
#	src/Service/AnrAmvService.php
…bstract

* origin/master:
  Fixed Amv batch removal to convert the related instance risks to specific.
  Fixed the amvs removal from the KB, to set instance risks as specific.
  Fixed the import issue when some data is empty.
…bstract

* origin/master: (36 commits)
  Fixed the import config retriving.
  Fixed the long objects' names generation issue and only add 'Imp #' within the same category.
  Fixed the objects names duplications and added the cache cleanup after import is finished.
  Update AssetImportService.php
  Update AssetImportService.php
  Update ApiAnrObjectsImportController.php
  Update AnrObjectService.php
  Update AssetImportService.php
  Update ApiAnrObjectsImportController.php
  Update ImportAnalysesCommand.php
  Update ImportAnalysesCommand.php
  Added createSnapshot option
  Removed the extra property definition as it is set in the superclass.
  Maneged the errors displaying and automatic creation of snapshots before import starts.
  Update VulnerabilityTable.php
  Added the cache for threats and vulnerabilities codes during assets' import.
  Update AssetImportService.php
  Update ThreatTable.php
  Updated the status output.
  Removed the config check in the anr import command, added possibility to delete anr when import error or waiting for imprort.
  ...

# Conflicts:
#	Module.php
#	config/module.config.php
#	src/Import/Service/InstanceImportService.php
#	src/Import/Service/ObjectImportService.php
#	src/Model/Table/ThemeTable.php
#	src/Service/AnrObjectService.php
#	src/Service/AnrService.php
#	src/Service/AnrServiceFactory.php
#	src/Service/AssetImportService.php
#	src/Table/AmvTable.php
#	src/Table/ThreatTable.php
#	src/Table/VulnerabilityTable.php
…, and vulnerability contraollers, partially anr.
…bstract

* origin/master: (21 commits)
  Update DeliverableGenerationService.php
  Update AnrThreatService.php
  Update ApiUserProfileController.php
  Changed the core lib requirement.
  Fixed the phinx configuration.
  Added the necessary return type void.
  Changed the packages recommended versions.
  Fixed the CS issue.
  Removed the error throwing when due date of recommendation is not valid.
  Fixed the recovery codes obtaining.
  FIxed the migration filed's length.
  Fixed the dependency dev version use.
  Update InstanceImportService.php
  Fixed merge with master branch
  Fixed semantic of composer.json
  fix issue with count
  add a condition to only count on countable
  Fixed SOA import for old anr export files
  Removed useless imagick PHP module
  Removed the laminas/laminas-console dependency.
  ...

# Conflicts:
#	composer.json
#	src/Controller/ApiUserProfileController.php
#	src/Import/Service/InstanceImportService.php
#	src/Service/AnrThreatService.php
…bstract

* origin/master:
  Fixed the analysis snashots creation and creation based on the existing analysis in case of custom objects.
…bstract

* origin/master:
  CS fixes.
  FIxed the issues of count determining in the controller.
  Fixed the code styles.
  Code style fixes.
  Prevented possible errors for the max value calculation.

# Conflicts:
#	src/Stats/Service/StatsAnrService.php
@ruslanbaidan ruslanbaidan changed the title Refactored the whole project Refactoring most of the project Sep 11, 2024
@ruslanbaidan ruslanbaidan merged commit d7c2e85 into master Oct 2, 2024
2 checks passed
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