trebol-ecommerce / trebol-backend-monolith

Monolithic eCommerce backend web application that exposes a RESTful API.
MIT License
16 stars 21 forks source link

refactor: redesign `ITwoWayConverterJpaService` #227

Closed bglamadrid closed 1 year ago

bglamadrid commented 1 year ago

PR Checklist

PR Type

Summary

Reduced complexity of several classes in the org.trebol.jpa.services package by extracting a method out of the ITwoWayConverterJpaService interface into a new IDataTransportJpaService interface. It also affects other classes that interact with these two interfaces.

This was a very needed change because the interaction between the crud and converter services was very confusing, specially for the ProductCategory and Sell entities which have some interesting quirks (the former can be linked to a parent of its own type and even cascade a whole category tree, while the latter has a lot of relationships to several other entities). It was hard to draw the line of responsibility while creating and updating data related to these.

This refactor basically aims to make the algorithms for CRUD operations much more streamlined and easy to follow.

Unit tests are being refactored accordingly. Yet, at the time of writing (and editing), these remain broken and must be fixed.

Closes #116

NyorJa commented 1 year ago

It seems there are failed test in this PR @bglamadrid

bglamadrid commented 1 year ago

I know, thanks for the heads up @NyorJa

Just wanted to submit this now as a sort of warning token; see how many files I'm updating here. Hopefully no one touches these. Otherwise, merge conflicts will be a real pain. 😆

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

72.8% 72.8% Coverage
0.0% 0.0% Duplication