-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Milestone
Description
DDD plan
- code is separated into layers: API (controller), domain (model + service), infra (repository)
- layers communicate like:
Controller->Service->Repositoryand ONLY like that. -
Servicecan use otherServices,Repositorycan use otherRepositories,Servicecan use only oneRepository! - If endpoint has a
PUTedit endpoint, it should ideally also have aPATCHedit endpoint, wherePUTtakes whole object, andPATCHjust some of the object fields.
API layer
- input data validation, conversion, etc. should be handled in
Controller -
Controllercan callService, controller also usesDtosandMappers -
Controlleris the only place in the app that knows about users as in their credentials and authorities - Use
Authentication authenticationas parameter andauthentication.getPrincipal()to get logged inUser - Use
@...Mapping(params = ...)to separate logic depending on parameter
Domain layer
-
ServicesreturnModelobjects, there are noDtosin anyService - Exceptions are thrown in
Services - Thrown exceptions are semantic!
Infrastructure layer
- All SQL calls are prepared to do things in the DBMS
- No tolerance for situations such as getting huge amounts of data from database just to filter it in backend
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels