You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the service layer of the API has a lot of contamination within its business logic. The proposal is to change the software layers to the following:
Routers, talk to the service layer and are responsible for changing the "business logic" models into "API" models
Services, contain core business logic like:
Validating the action can reasonably be performed
Validating the action is allowed to be performed
Starting all actions in the way they are supposed to
Data abstraction layer, interfaces defining the core concepts of data storage for the business logic
Caching, contains the Redis caching code, conforming to the business layer data storage abstraction
Repo, contains the DB persistence code, also conforming to the business layer data storage abstraction
This layered system has the following interface layers
Service interfaces
The router layer demands implementations of the service layer
Data storage interfaces
The service layer, and caching layer, demand implementations of the data storage layer
By splitting it in these layers, it becomes possible to:
Test the router JSON validity and request parsing in isolation
Test the service behavior with easy to inject data types and analyze its behavior on the data storage in isolation
Test the caching behavior in isolation
Test the repo query logic in isolation
Swap out the caching layer for direct repo access
Swap out the repo implementation with another
The text was updated successfully, but these errors were encountered:
Currently, the service layer of the API has a lot of contamination within its business logic. The proposal is to change the software layers to the following:
This layered system has the following interface layers
The router layer demands implementations of the service layer
The service layer, and caching layer, demand implementations of the data storage layer
By splitting it in these layers, it becomes possible to:
The text was updated successfully, but these errors were encountered: