[Koha-bugs] [Bug 19370] Add a helper function for translating order_by params into SQL ::Abstract
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Sat Oct 7 14:43:33 CEST 2017
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19370
Lari Taskula <lari.taskula at jns.fi> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #67403|0 |1
is obsolete| |
--- Comment #10 from Lari Taskula <lari.taskula at jns.fi> ---
Created attachment 67783
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67783&action=edit
Bug 19370: Add helper function for order_by attribute generation
This patch introduces a helper function called 'dbic_merge_sorting'
to Koha::REST::Plugin::Query.
This simple function adds SQL::Abstract order_by attribute to the passed
$filter hashref, as explained in the POD.
It introduces a syntax for passing sorting params on the request to the REST
api.
The proposed syntax has been found in the wild, and is pretty trivial to
parse/work with:
GET /api/v1/<endpoint>?order_by=+column_1|-column_2|column_3
As explained on the POD, + stands for 'asc' and - for 'desc'. If ommited, it
defaults to the
DB engine default (usually asc).
To test:
- Apply this patches
- Run:
$ sudo koha-shell kohadev
k$ cd kohaclone
k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass! And they make sense! :-P
- Sign off :-D
Edit: renamed params to match DBIC terminology. My bad :-D (tcohen)
Sponsored-by: Camden County
Signed-off-by: Lari Taskula <lari.taskula at jns.fi>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list