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 Backend Architecture #584

Open
1 task
aaronzi opened this issue Jan 10, 2025 · 0 comments
Open
1 task

Refactor Backend Architecture #584

aaronzi opened this issue Jan 10, 2025 · 0 comments
Assignees

Comments

@aaronzi
Copy link
Member

aaronzi commented Jan 10, 2025

Linked to #570 (Phase 1 PR)

Motivation

The current backend architecture relies heavily on the service layer to interact with the internals of the entities saved in the repositories. Much of the operations could be done more efficiently at the backend level, profiting from performance enhancements and modularity.

Other than that, concurrency and scalability could be easier achieved with comparably less impact on performance.

Roadmap

The scope of the changes is large. Therefore, the changes will be implemented in several phases:

Phase 1: Structural changes ✅

  1. Refactor Crud*Repository (service layer) to receive the *Backend as a Spring component
  2. Replace InMemory implementation with a spring-data provided (JPA + H2 e.g.)
  3. Replace the *Service dependency in the Service Level with the *Backend using repository fragments (*ServiceBackend) [1, 2]
  4. Implement the *ServiceBackend for InMemory and MongoDB [2]

Tests must be adapted according to the changes.

Phase 2: Filtering

Supersedes #516

  1. Add QueryDslExecutor [3] to *Backend
  2. Implement getAll* using the QueryDsl

Phase 3: Pagination

Look at [4] for example using PagingAndSortingRepository

  • Refine

Jannis Norte:
Found implementation for MongoDB; see [5]

References

[1] https://docs.spring.io/spring-data/mongodb/docs/3.3.5/reference/html/#repositories.custom-implementations
[2] https://github.com/spring-projects/spring-data-examples/tree/main/mongodb/aggregation/src/main/java/example/springdata/mongodb/aggregation
[3] https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/querydsl/QuerydslPredicateExecutor.html
[4] https://docs.spring.io/spring-data/mongodb/docs/3.3.5/reference/html/#repositories.definition
[5] https://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Sprint
Development

No branches or pull requests

4 participants