Bug 19369 - Add a helper function for translating pagination params into SQL::Abstract
Summary: Add a helper function for translating pagination params into SQL::Abstract
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact:
URL:
Keywords:
Depends on: 19234
Blocks: 18731 19278 19410
  Show dependency treegraph
 
Reported: 2017-09-26 18:04 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2018-12-03 20:04 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 19369: Unit tests (1.73 KB, patch)
2017-09-26 18:15 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 19369: Add helper function for pagination attributes generation (1.70 KB, patch)
2017-09-26 18:15 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 19369: Unit tests (1.72 KB, patch)
2017-09-26 18:31 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 19369: Add helper function for pagination attributes generation (1.69 KB, patch)
2017-09-26 18:31 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 19369: Unit tests (1.77 KB, patch)
2017-10-03 10:45 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 19369: Add helper function for pagination attributes generation (1.74 KB, patch)
2017-10-03 10:45 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 19369: Unit tests (1.83 KB, patch)
2017-11-27 11:35 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 19369: Add helper function for pagination attributes generation (1.80 KB, patch)
2017-11-27 11:35 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2017-09-26 18:04:16 UTC
It would be handy to have a helper function in Koha::REST::Plugin::Pagination generating 'page' and 'rows' attributes out of the query params, to be used when listing objects on the REST api endpoints.
Comment 1 Tomás Cohen Arazi (tcohen) 2017-09-26 18:15:55 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2017-09-26 18:15:58 UTC Comment hidden (obsolete)
Comment 3 Tomás Cohen Arazi (tcohen) 2017-09-26 18:31:09 UTC
Created attachment 67381 [details] [review]
Bug 19369: Unit tests
Comment 4 Tomás Cohen Arazi (tcohen) 2017-09-26 18:31:15 UTC
Created attachment 67382 [details] [review]
Bug 19369: Add helper function for pagination attributes generation

This patch introduces a new helper function to the Koha::REST::Plugin::Pagination
plugin, called 'dbic_merge_pagination'.

This simple function adds SQL::Abstract pagination attributes ('page' and 'rows') to the
passed $filter hashref.

To test:
- Apply this patches
- Run:
  $ koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: Camden County
Comment 5 Lari Taskula 2017-10-03 10:45:27 UTC
Created attachment 67544 [details] [review]
Bug 19369: Unit tests

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Comment 6 Lari Taskula 2017-10-03 10:45:43 UTC
Created attachment 67545 [details] [review]
Bug 19369: Add helper function for pagination attributes generation

This patch introduces a new helper function to the Koha::REST::Plugin::Pagination
plugin, called 'dbic_merge_pagination'.

This simple function adds SQL::Abstract pagination attributes ('page' and 'rows') to the
passed $filter hashref.

To test:
- Apply this patches
- Run:
  $ koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: Camden County

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Comment 7 Kyle M Hall (khall) 2017-11-27 11:35:50 UTC
Created attachment 69363 [details] [review]
Bug 19369: Unit tests

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Kyle M Hall (khall) 2017-11-27 11:35:56 UTC
Created attachment 69364 [details] [review]
Bug 19369: Add helper function for pagination attributes generation

This patch introduces a new helper function to the Koha::REST::Plugin::Pagination
plugin, called 'dbic_merge_pagination'.

This simple function adds SQL::Abstract pagination attributes ('page' and 'rows') to the
passed $filter hashref.

To test:
- Apply this patches
- Run:
  $ koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Pagination.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: Camden County

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Jonathan Druart 2017-12-11 20:47:37 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 10 Nick Clemens (kidclamp) 2017-12-20 11:40:59 UTC
Awesome work all! Enhancement, won't be backported to 17.11