|
Lines 65-71
sub get {
Link Here
|
| 65 |
openapi => { error => "City not found" } ); |
65 |
openapi => { error => "City not found" } ); |
| 66 |
} |
66 |
} |
| 67 |
|
67 |
|
| 68 |
return $c->render( status => 200, openapi => _to_api($city->TO_JSON) ); |
68 |
return $c->render( status => 200, openapi => $city->to_api ); |
| 69 |
} |
69 |
} |
| 70 |
|
70 |
|
| 71 |
=head3 add |
71 |
=head3 add |
|
Lines 78-84
sub add {
Link Here
|
| 78 |
return try { |
78 |
return try { |
| 79 |
my $city = Koha::City->new( _to_model( $c->validation->param('body') ) ); |
79 |
my $city = Koha::City->new( _to_model( $c->validation->param('body') ) ); |
| 80 |
$city->store; |
80 |
$city->store; |
| 81 |
return $c->render( status => 200, openapi => _to_api($city->TO_JSON) ); |
81 |
return $c->render( status => 200, openapi => $city->to_api ); |
| 82 |
} |
82 |
} |
| 83 |
catch { |
83 |
catch { |
| 84 |
if ( $_->isa('DBIx::Class::Exception') ) { |
84 |
if ( $_->isa('DBIx::Class::Exception') ) { |
|
Lines 114-120
sub update {
Link Here
|
| 114 |
my $params = $c->req->json; |
114 |
my $params = $c->req->json; |
| 115 |
$city->set( _to_model($params) ); |
115 |
$city->set( _to_model($params) ); |
| 116 |
$city->store(); |
116 |
$city->store(); |
| 117 |
return $c->render( status => 200, openapi => _to_api($city->TO_JSON) ); |
117 |
return $c->render( status => 200, openapi => $city->to_api ); |
| 118 |
} |
118 |
} |
| 119 |
catch { |
119 |
catch { |
| 120 |
if ( $_->isa('Koha::Exceptions::Object') ) { |
120 |
if ( $_->isa('Koha::Exceptions::Object') ) { |
| 121 |
- |
|
|