-
Notifications
You must be signed in to change notification settings - Fork 959
BE-346-Added Pagination for Transaction view - Backend #351
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
Conversation
page: any, | ||
size: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick]: type will be number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the code as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please define the types for all the parameters.
) { | ||
var countOfTxns: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick]: type will be number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sqlQuery is expected to return the count of transactions and incase if it fails to do so, it returns "null". The second thing is if page=1 then we would be sending the "noOfPages" in response and for the remaining pages we would send it as "null". So considering these cases assigned the type as "any" to countOfTxns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pipes can be used something like this let countOfTxns : number | Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried with these combinations: var countOfTxns: number | null = null; Error is not a type and can't be defined. since we are applying arithmetic operation on countOfTransactions to derive noOfpages, the allowed types are number, any, bigInt, enum. I cant define type to be only "number" since there is a case of countOfTransactions to be null.
Below are the errors with wrong type definition:
error TS2322: Type 'unknown' is not assignable to type 'number'.
error Type 'unknown' is not assignable to type 'number | Error'.
error The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
So, I can define type to be "any" (or) number | unknown.
Signed-off-by: ArchanaArige <[email protected]>
What this PR does / why we need it:
This feature implements the pagination for list of transactions to be fetched from PostgreSQL. As of now the pagination is being handled from UI. Implementing pagination from backend addresses an issue when dealing with retrieval of huge data sets.
Which issue(s) this PR fixes:
Fixes #346
Special notes for your reviewer:
This enhancement is tied up with UI-changes: ref Issue#347
Does this PR introduce a user-facing change?
Additional documentation, usage docs, etc.: