@@ -, +, @@ --- Koha/REST/V1/Clubs/Holds.pm | 2 +- api/v1/swagger/paths/clubs.json | 8 +++++++- t/db_dependent/api/v1/clubs_holds.t | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) --- a/Koha/REST/V1/Clubs/Holds.pm +++ a/Koha/REST/V1/Clubs/Holds.pm @@ -132,7 +132,7 @@ sub add { if ( blessed $_ ) { if ($_->isa('Koha::Exceptions::ClubHold::NoPatrons')) { return $c->render( - status => 403, + status => 409, openapi => { error => $_->description } ); } --- a/api/v1/swagger/paths/clubs.json +++ a/api/v1/swagger/paths/clubs.json @@ -81,6 +81,12 @@ "$ref": "../definitions.json#/error" } }, + "409": { + "description": "Hold not allowed", + "schema": { + "$ref": "../definitions.json#/error" + } + }, "500": { "description": "Internal server error", "schema": { @@ -101,4 +107,4 @@ } } } -} +} --- a/t/db_dependent/api/v1/clubs_holds.t +++ a/t/db_dependent/api/v1/clubs_holds.t @@ -86,7 +86,7 @@ subtest 'add() tests' => sub { $t->post_ok( "//$userid:$password@/api/v1/clubs/" . $club_without_enrollments->id . "/holds" => json => $data ) - ->status_is(403) + ->status_is(409) ->json_is( '/error' => "Cannot place a hold on a club without patrons." ); $t->post_ok( "//$userid:$password@/api/v1/clubs/" --