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: move handling of total count and pagination to store [TECH-1664] #15486

Merged
merged 4 commits into from
Oct 27, 2023

Conversation

enricocolasante
Copy link
Contributor

Having the logic of fetching pageSize + 1 relationships in the store and the removal of the extra relationship in the service is error prone. This is now done transparently in the store.

Total count is expensive and should thus be discouraged. Do not expose this as part of the service as its not needed right now.

In this PR

Remove any pagination related fields and methods from RelationshipQueryParams as these are fully represented by the PageParams.
Remove lastPage concept as it is not exposed
Validate pagination params in the controller

@enricocolasante enricocolasante marked this pull request as draft October 25, 2023 11:07
@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #15486 (3d68bce) into master (b510f69) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master   #15486   +/-   ##
=========================================
  Coverage     66.14%   66.15%           
- Complexity    31183    31185    +2     
=========================================
  Files          3487     3487           
  Lines        129761   129752    -9     
  Branches      15136    15133    -3     
=========================================
+ Hits          85829    85832    +3     
+ Misses        36840    36830   -10     
+ Partials       7092     7090    -2     
Flag Coverage Δ
integration 49.71% <50.00%> (+<0.01%) ⬆️
integration-h2 32.39% <100.00%> (-0.01%) ⬇️
unit 30.33% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...xport/relationship/DefaultRelationshipService.java 92.63% <ø> (+7.19%) ⬆️
...xport/relationship/HibernateRelationshipStore.java 90.00% <100.00%> (-0.20%) ⬇️
...rt/relationship/RelationshipsExportController.java 70.00% <100.00%> (+0.76%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b510f69...3d68bce. Read the comment docs.

private Integer page;
private Integer pageSize;
private Boolean totalPages;
private Boolean skipPaging;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getSkipPaging
; it is advisable to add an Override annotation.
static final String DEFAULT_FIELDS_PARAM =
"relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]]";

private Integer page;
private Integer pageSize;
private Boolean totalPages;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getTotalPages
; it is advisable to add an Override annotation.
static final String DEFAULT_FIELDS_PARAM =
"relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]]";

private Integer page;
private Integer pageSize;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getPageSize
; it is advisable to add an Override annotation.
static final String DEFAULT_FIELDS_PARAM =
"relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]]";

private Integer page;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getPage
; it is advisable to add an Override annotation.
@enricocolasante enricocolasante marked this pull request as ready for review October 26, 2023 11:04
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@enricocolasante enricocolasante merged commit 8183caa into master Oct 27, 2023
18 checks passed
@enricocolasante enricocolasante deleted the TECH-1664-pagination-to-store branch October 27, 2023 07:24
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.

2 participants