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

chore: Remove preprocess that filters out deleted entitites in tracker stores [DHIS2-18883] #19921

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

enricocolasante
Copy link
Contributor

@enricocolasante enricocolasante commented Feb 13, 2025

Remove preProcessPredicates and postProcessObject methods from entity stores. Now, when getting an entity using any method from the store, we need to check if the entity is deleted or not.

We still need to have the isDeleted check in a few places in our services but we want to remove them, we should check for it only in the stores:

  • TrackedEntityService: it will be removed when completing https://dhis2.atlassian.net/browse/DHIS2-18541. (One of next PRs)
  • RelationshipService: relationships do not work as the other entities so there is some thinking to do here (we don't have a clear single vs multiple methods as the other entities have). It may be removed in one of next PRs
  • OperationsParamsValidator: we need to retrieve the parent entity (trackedEntity for enrollment and enrollment for event) to check for existence. We need to fix the logic to consider parameter includeDeleted when checking for existence. This is needed when a parent service is calling a child service (TrackedEntityService calling EnrollmentService) and the parent entity is soft-deleted. More details will come in the PR working on this.

Next steps

  • Fix isDeleted check in OperationsParamsValidator
  • Check how we should deal with deleted entities in RelationshipService.
  • Check if we can remove isDeleted check from RelationshipService
  • Serve multiple and single tracked entities using the same path
  • Pass field params to RelationshipService in order to only retrieve from the DB what is needed.
  • Changing the test input to use the view model in relationship tests

@enricocolasante enricocolasante marked this pull request as ready for review February 14, 2025 10:48
@enricocolasante enricocolasante requested a review from a team as a code owner February 14, 2025 10:48
@enricocolasante enricocolasante enabled auto-merge (squash) February 17, 2025 08:10
@@ -43,6 +43,10 @@ public class PageParams {
private static final int DEFAULT_PAGE = 1;
private static final int DEFAULT_PAGE_SIZE = 50;

public static PageParams single() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just throwing this out there. I have see "first()" used in libs, that could be a potential name here as well. No strong opinions

@enricocolasante enricocolasante merged commit 111fbbd into master Feb 17, 2025
17 checks passed
@enricocolasante enricocolasante deleted the DHIS2-18883-remove-preprocess branch February 17, 2025 08:40
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

Successfully merging this pull request may close these issues.

3 participants