Bugzilla – Attachment 156752 Details for
Bug 30719
ILL should provide the ability to create batch requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30719: QA follow-up: Rewrite ill batches get endpoint
Bug-30719-QA-follow-up-Rewrite-ill-batches-get-end.patch (text/plain), 4.05 KB, created by
Pedro Amorim
on 2023-10-09 15:54:36 UTC
(
hide
)
Description:
Bug 30719: QA follow-up: Rewrite ill batches get endpoint
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-10-09 15:54:36 UTC
Size:
4.05 KB
patch
obsolete
>From 0727b8ae886c3554b9dbb7394f4a919d2ce0b700 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 9 Oct 2023 15:54:54 +0000 >Subject: [PATCH] Bug 30719: QA follow-up: Rewrite ill batches get endpoint > >--- > Koha/REST/V1/Illbatches.pm | 37 ++++++++++----------------- > api/v1/swagger/paths/ill_batches.yaml | 20 +++++++++++++++ > t/db_dependent/api/v1/ill_batches.t | 3 ++- > 3 files changed, 36 insertions(+), 24 deletions(-) > >diff --git a/Koha/REST/V1/Illbatches.pm b/Koha/REST/V1/Illbatches.pm >index b8edbc815e..9cc6e56808 100644 >--- a/Koha/REST/V1/Illbatches.pm >+++ b/Koha/REST/V1/Illbatches.pm >@@ -56,34 +56,25 @@ Get one batch > =cut > > sub get { >- my $c = shift->openapi->valid_input; >+ my $c = shift->openapi->valid_input or return; > >- my $batchid = $c->param('ill_batch_id'); >+ return try { >+ my $ill_batch = $c->objects->find( Koha::Illbatches->search, $c->param('ill_batch_id') ); > >- my $batch = Koha::Illbatches->find($batchid); >+ unless ($ill_batch) { >+ return $c->render( >+ status => 404, >+ openapi => { error => "ILL batch not found" } >+ ); >+ } > >- if ( not defined $batch ) { > return $c->render( >- status => 404, >- openapi => { error => "ILL batch not found" } >+ status => 200, >+ openapi => $ill_batch > ); >- } >- >- return $c->render( >- status => 200, >- openapi => { >- batch_id => $batch->id, >- backend => $batch->backend, >- library_id => $batch->branchcode, >- name => $batch->name, >- statuscode => $batch->statuscode, >- patron_id => $batch->borrowernumber, >- patron => $batch->patron->unblessed, >- branch => $batch->branch->unblessed, >- status => $batch->status->unblessed, >- requests_count => $batch->requests_count >- } >- ); >+ } catch { >+ $c->unhandled_exception($_); >+ }; > } > > =head3 add >diff --git a/api/v1/swagger/paths/ill_batches.yaml b/api/v1/swagger/paths/ill_batches.yaml >index caada10af8..4eb5f0cf23 100644 >--- a/api/v1/swagger/paths/ill_batches.yaml >+++ b/api/v1/swagger/paths/ill_batches.yaml >@@ -127,6 +127,26 @@ > description: ILL batch id/name/contents > required: true > type: string >+ - $ref: "../swagger.yaml#/parameters/page" >+ - $ref: "../swagger.yaml#/parameters/per_page" >+ - $ref: "../swagger.yaml#/parameters/match" >+ - $ref: "../swagger.yaml#/parameters/order_by" >+ - $ref: "../swagger.yaml#/parameters/q_param" >+ - $ref: "../swagger.yaml#/parameters/q_body" >+ - $ref: "../swagger.yaml#/parameters/request_id_header" >+ - name: x-koha-embed >+ in: header >+ required: false >+ description: Embed list sent as a request header >+ type: array >+ items: >+ type: string >+ enum: >+ - +strings >+ - requests+count >+ - patron >+ - branch >+ collectionFormat: csv > produces: > - application/json > responses: >diff --git a/t/db_dependent/api/v1/ill_batches.t b/t/db_dependent/api/v1/ill_batches.t >index b658ee36c1..e7f5d74445 100755 >--- a/t/db_dependent/api/v1/ill_batches.t >+++ b/t/db_dependent/api/v1/ill_batches.t >@@ -161,7 +161,8 @@ subtest 'get() tests' => sub { > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $unauth_userid = $patron->userid; > >- $t->get_ok( "//$userid:$password@/api/v1/ill/batches/" . $batch->id )->status_is(200) >+ $t->get_ok( "//$userid:$password@/api/v1/ill/batches/" >+ . $batch->id => { 'x-koha-embed' => '+strings,requests+count,patron,branch' } )->status_is(200) > ->json_has( '/batch_id', 'Batch ID' )->json_has( '/name', 'Batch name' ) > ->json_has( '/backend', 'Backend name' )->json_has( '/patron_id', 'Borrowernumber' ) > ->json_has( '/library_id', 'Branchcode' )->json_has( '/patron', 'patron embedded' ) >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30719
:
144281
|
144285
|
144286
|
144287
|
144288
|
144289
|
144290
|
144291
|
144292
|
144293
|
144294
|
144295
|
144296
|
144297
|
144298
|
144299
|
144300
|
144301
|
144302
|
145760
|
145869
|
145870
|
145876
|
145934
|
146152
|
147658
|
147929
|
147930
|
147931
|
147932
|
147933
|
147934
|
147952
|
147953
|
147954
|
147955
|
147956
|
151152
|
151153
|
151154
|
151155
|
151156
|
151284
|
151285
|
151286
|
151287
|
151288
|
151303
|
151304
|
151305
|
151306
|
151307
|
151308
|
151309
|
151310
|
151311
|
151312
|
151513
|
151514
|
151515
|
151516
|
151517
|
151519
|
151520
|
151521
|
151522
|
151523
|
151571
|
151572
|
151573
|
151574
|
151575
|
151611
|
151612
|
151613
|
151614
|
151615
|
151804
|
151805
|
151806
|
151807
|
151808
|
151809
|
154046
|
154047
|
154048
|
154049
|
154050
|
154051
|
154052
|
155421
|
155422
|
155423
|
155424
|
155425
|
155426
|
155427
|
155428
|
155429
|
155430
|
155431
|
155432
|
155433
|
155434
|
155435
|
156556
|
156748
|
156749
|
156752
|
156783
|
156785
|
156811
|
156812
|
156827
|
156828