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

Refactor services and mappers as services and repositories #97

Open
carltonwhitehead opened this issue Jul 29, 2023 · 0 comments
Open
Assignees

Comments

@carltonwhitehead
Copy link
Contributor

Mappers having references to services is a clue that they're really acting as repositories. If they were truly adapters, they'd take pure layer-appropriate arguments and return a different-layer result.

As they are now, the responsibility for loading data is spread around services, mappers, and constraints.

Consolidate the loading and saving of records into repositories.

Services should call the repositories to retrieve domain objects, perform any mutations, invoke constraints for validation, and call the repositories to store domain objects.

Constraints should chiefly concern themselves with performing validation against domain objects. There are some constraints which apply to relational data (mutating supporting entities like Policy for Events with Lifecycle.FINAL, etc) which will require a repository call to carry out.

@carltonwhitehead carltonwhitehead self-assigned this Jul 29, 2023
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

No branches or pull requests

1 participant