Added searchCampRequest and searchCampResponse for searching camps#11
Added searchCampRequest and searchCampResponse for searching camps#11anubratabhowmick wants to merge 1 commit intodevelopmentfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## development #11 +/- ##
============================================
Coverage 100% 100%
Complexity 26 26
============================================
Files 5 5
Lines 92 92
Branches 3 3
============================================
Hits 92 92Continue to review full report at Codecov.
|
|
|
||
| Integer pageSize; | ||
|
|
||
| String sortBy; |
There was a problem hiding this comment.
Why is this required in the response?
There was a problem hiding this comment.
Shouldn't we show on which basis the page is sorted?
There was a problem hiding this comment.
the client will be passing the sortBy field to you. How does it add any value to return the same thing back in the response?
|
|
||
| Integer pageNo; | ||
|
|
||
| Integer pageSize; |
There was a problem hiding this comment.
Why is this required in the response?
There was a problem hiding this comment.
Won't we have to show the page number?
There was a problem hiding this comment.
but this is pageSize, which is being passed by the client to begin with.
|
|
||
| Long actualNoOfDonors; | ||
|
|
||
| Integer pageNo; |
There was a problem hiding this comment.
Instead of returning the page number, is there a way we can return the total number of results instead? That way calculating page number will be easy as we can just do totalResults/pageSize. This will also allows us to change the pageSize and still use the same request.
There was a problem hiding this comment.
We can return the number of rows fetched from the database and return that as totalNoOfResponse to get how many camps are present, which can be used to calculate and modify pageSize. Does that work?
There was a problem hiding this comment.
What do you mean by 'the number of rows fetched from the database'? The database query will only return rows equal to the size of the page being passed since we want a paginated query, and if you return that number, our calculation will always show that only a single page exists, which might not be correct.
However, if you mean this is the total number of rows which match the given query then, yes, that works.
There was a problem hiding this comment.
Yes yes... Total no. of rows 🥇
|
|
||
| private String actualNoOfDonors; | ||
|
|
||
| Integer pageNo; |
There was a problem hiding this comment.
add validation to ensure this is greater than 0.
There was a problem hiding this comment.
forgot to mention, you can do this very cleanly by just using jsrValidations. Add hibernate-validator as a dependency.
|
|
||
| Integer pageNo; | ||
|
|
||
| Integer pageSize; |
There was a problem hiding this comment.
add validation to ensure this is greater than 0
|
|
||
| Integer pageSize; | ||
|
|
||
| String sortBy; |
There was a problem hiding this comment.
Can we use an enum with all the fields of CampModel and accept that here instead of String?
|
|
||
| private String partnerId; | ||
|
|
||
| private Date dateOfCamp; |
There was a problem hiding this comment.
how are you going to handle range queries?
|
|
||
| @Value | ||
| @Builder | ||
| public class SearchCampRequest { |
There was a problem hiding this comment.
Are we going to handle AND and OR searches? For example,
- Search for all camps where partnerId = A OR partnerId = B
- Search for all camps where partnerId = A AND dateOfCamp between(date1, date2)
No description provided.