Bug 23893: Use in /cities
This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
340f77732a
commit
c46c86b3e7
|
|
@ -76,7 +76,7 @@ sub add {
|
|||
my $c = shift->openapi->valid_input or return;
|
||||
|
||||
return try {
|
||||
my $city = Koha::City->new( _to_model( $c->validation->param('body') ) );
|
||||
my $city = Koha::City->new_from_api( $c->validation->param('body') );
|
||||
$city->store;
|
||||
$c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid );
|
||||
return $c->render(
|
||||
|
|
@ -115,8 +115,7 @@ sub update {
|
|||
}
|
||||
|
||||
return try {
|
||||
my $params = $c->req->json;
|
||||
$city->set( _to_model($params) );
|
||||
$city->set_from_api( $c->validation->param('body') );
|
||||
$city->store();
|
||||
return $c->render( status => 200, openapi => $city->to_api );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue