[Koha-bugs] [Bug 24528] Add a syntax for specifying counts on x-koha-embed

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jan 31 08:58:51 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24528

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #98201|0                           |1
        is obsolete|                            |

--- Comment #12 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Created attachment 98214
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98214&action=edit
Bug 24528: Add a syntax to x-koha-embed to specify counts

This patch adds a + syntax to specify on the x-koha-embed header that we
want the count of a relation in the response. For example:

GET /patrons/1
x-koha-embed: checkouts+count

Would return a JSON representation of a Koha::Patron, with a new
attribute added: checkouts_count, which will be the result of calling
$patron->checkouts->count.

This is all done automatically in to_api. This patch makes parsing the
x-koha-embed header build the right structure for passing to the to_api
method.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: David Nind <david at davidnind.com>

Signed-off-by: David Nind <david at davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list