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

feat: Sort & Filter attribute change logs [DHIS2-18475] #19331

Merged
merged 12 commits into from
Dec 3, 2024

Conversation

muilpp
Copy link
Contributor

@muilpp muilpp commented Nov 28, 2024

This PR introduces filtering for attribute change logs. These filters differ slightly from the ones we currently use:

  • They accept only one field at a time.
  • They support only the equals operator.
  • Sorting is limited to date, username and attribute. Filtering to username and attribute.

Another key difference is that while our current filters are UID based, these new filters are string based.

Although the only supported operator is eq, I’ve retained the filter format [field]:[operator]:[filter] used in other endpoints. This way, if we need to support additional operators in the future, it won’t require a breaking change.

@muilpp muilpp changed the title Dhis2 18475 filter attribute change logs feat: Filter attribute change logs [DHIS2-18475] Nov 28, 2024
@muilpp muilpp changed the title feat: Filter attribute change logs [DHIS2-18475] feat: Sort & Filter attribute change logs [DHIS2-18475] Nov 29, 2024
@muilpp muilpp marked this pull request as ready for review December 3, 2024 10:40
@muilpp muilpp requested a review from a team as a code owner December 3, 2024 10:40
@muilpp muilpp requested review from ameenhere and teleivo December 3, 2024 12:13
@@ -313,7 +313,7 @@ public static void validateFilter(String filter, Set<Pair<String, Class<?>>> sup
for (Pair<String, Class<?>> filterField : supportedFields) {
if (filterField.getKey().equalsIgnoreCase(split[0])
&& filterField.getValue() == UID.class
&& !CodeGenerator.isValidUid(filterField.getKey())) {
&& !CodeGenerator.isValidUid(split[2])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What test tests this fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and now RequestParamsValidatorTest.shouldFailWhenChangeLogFilterDoesNotHaveCorrectUidFormat too
just that before it was validating the key instead of the value

@muilpp muilpp enabled auto-merge (squash) December 3, 2024 12:52
Copy link

sonarqubecloud bot commented Dec 3, 2024

@muilpp muilpp merged commit 9b2ce34 into master Dec 3, 2024
15 checks passed
@muilpp muilpp deleted the DHIS2-18475-filter-attribute-change-logs branch December 3, 2024 13:05
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