Bugzilla – Attachment 94400 Details for
Bug 23770
Add Koha::Object(s)->to_api method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23770: (follow-up) Use ->to_api in /cities
Bug-23770-follow-up-Use--toapi-in-cities.patch (text/plain), 2.08 KB, created by
Marcel de Rooy
on 2019-10-18 09:00:14 UTC
(
hide
)
Description:
Bug 23770: (follow-up) Use ->to_api in /cities
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-10-18 09:00:14 UTC
Size:
2.08 KB
patch
obsolete
>From 0daf042bc632cb1e356d14af16036de96b98d8f2 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 8 Oct 2019 15:43:10 -0300 >Subject: [PATCH] Bug 23770: (follow-up) Use ->to_api in /cities >Content-Type: text/plain; charset=utf-8 > >This patch aims to prove the behaviour does not differ. So you can run >the tests for the endpoints, and the behaviour remains. > >The mappings and methods cannot be removed until $c->objects->search is >fixed to make use of them as well. That will happen once all used >Koha::Object-based classes implement the mappings. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/cities.t >=> SUCCESS: Tests pass! > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/REST/V1/Cities.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Cities.pm b/Koha/REST/V1/Cities.pm >index 5a579b4ee4..222f7c0015 100644 >--- a/Koha/REST/V1/Cities.pm >+++ b/Koha/REST/V1/Cities.pm >@@ -65,7 +65,7 @@ sub get { > openapi => { error => "City not found" } ); > } > >- return $c->render( status => 200, openapi => _to_api($city->TO_JSON) ); >+ return $c->render( status => 200, openapi => $city->to_api ); > } > > =head3 add >@@ -78,7 +78,7 @@ sub add { > return try { > my $city = Koha::City->new( _to_model( $c->validation->param('body') ) ); > $city->store; >- return $c->render( status => 200, openapi => _to_api($city->TO_JSON) ); >+ return $c->render( status => 200, openapi => $city->to_api ); > } > catch { > if ( $_->isa('DBIx::Class::Exception') ) { >@@ -114,7 +114,7 @@ sub update { > my $params = $c->req->json; > $city->set( _to_model($params) ); > $city->store(); >- return $c->render( status => 200, openapi => _to_api($city->TO_JSON) ); >+ return $c->render( status => 200, openapi => $city->to_api ); > } > catch { > if ( $_->isa('Koha::Exceptions::Object') ) { >-- >2.11.0
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 23770
:
93831
|
93881
|
93882
|
93883
|
93888
|
93890
|
93891
|
93892
|
93893
|
93894
|
93895
|
94396
|
94397
|
94398
|
94399
| 94400