@@ -, +, @@ - Specifying boolean properties as boolean in the schema file - Fixes the controller so it returns Koha::Hold objects instead of the hashref returned by GetReserve, which is wrong. - Better (than empty) descriptions are added to 'suspend', 'suspend_until' and 'lowestPriority' on the spec. - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/db_dependent/api/v1/holds.t - Apply this patch - Run: k$ prove t/db_dependent/api/v1/holds.t - Sign off :-D --- Koha/REST/V1/Hold.pm | 7 ++++--- Koha/Schema/Result/Reserve.pm | 5 +++++ api/v1/swagger/definitions/hold.json | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) --- a/Koha/REST/V1/Hold.pm +++ a/Koha/REST/V1/Hold.pm @@ -34,7 +34,7 @@ sub list { foreach my $key (keys %$params) { delete $params->{$key} unless grep { $key eq $_ } @valid_params; } - my $holds = Koha::Holds->search($params)->unblessed; + my $holds = Koha::Holds->search($params); return $c->$cb($holds, 200); } @@ -106,7 +106,7 @@ sub add { }, 500); } - my $reserve = C4::Reserves::GetReserve($reserve_id); + my $reserve = Koha::Holds->find($reserve_id); return $c->$cb($reserve, 201); } @@ -137,8 +137,9 @@ sub edit { rank => $priority, suspend_until => $suspend_until, }; + C4::Reserves::ModReserve($params); - $reserve = C4::Reserves::GetReserve($reserve_id); + $reserve = Koha::Holds->find($reserve_id); return $c->$cb($reserve, 200); } --- a/Koha/Schema/Result/Reserve.pm +++ a/Koha/Schema/Result/Reserve.pm @@ -334,4 +334,9 @@ __PACKAGE__->belongs_to( }, ); +__PACKAGE__->add_columns( + '+lowestPriority' => { is_boolean => 1 }, + '+suspend' => { is_boolean => 1 } +); + 1; --- a/api/v1/swagger/definitions/hold.json +++ a/api/v1/swagger/definitions/hold.json @@ -59,15 +59,15 @@ }, "lowestPriority": { "type": "boolean", - "description": "" + "description": "Controls if the hold is given the lowest priority on the queue" }, "suspend": { "type": "boolean", - "description": "" + "description": "Controls if the hold is suspended" }, "suspend_until": { "type": ["string", "null"], - "description": "" + "description": "Date until which the hold has been suspended" }, "itemtype": { "type": ["string", "null"], --