Koha/api/v1/swagger/definitions/hold.json
Tomas Cohen Arazi 694c09aa87 Bug 18409: Make the controller for holds use Koha::Holds
Recently, there's been a major fix on the REST api swagger spec,
which involved fixing boolean values so they are actually booleans
and Koha::Object was extended to handle that.
While the swagger spec for this endpoint got fixed, such is not the case
with the implementation (the controller class).

This patch fixes this situation by:
- 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.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, mostly due to error 500 results.
- Apply this patch
- Run:
 k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
- Sign off :-D

This can also be tested using any interface for REST apis.

Note: This endpoint lacks several of the new guidelines and is not
complete (there's no GET for single holds, etc). It is also missing
exception handling. There are probably
other bug reports for that, just thought it was worth mentioning.

Followed test plan and this patch worked as intended
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2017-04-24 09:40:40 -04:00

77 lines
2.2 KiB
JSON

{
"type": "object",
"properties": {
"reserve_id": {
"$ref": "../x-primitives.json#/reserve_id"
},
"borrowernumber": {
"$ref": "../x-primitives.json#/borrowernumber"
},
"reservedate": {
"type": ["string", "null"],
"description": "the date the hold was placed"
},
"biblionumber": {
"$ref": "../x-primitives.json#/biblionumber"
},
"branchcode": {
"type": ["string", "null"],
"description": "code of patron's home branch"
},
"notificationdate": {
"type": ["string", "null"],
"description": "currently unused"
},
"reminderdate": {
"type": ["string", "null"],
"description": "currently unused"
},
"cancellationdate": {
"type": ["string", "null"],
"description": "the date the hold was cancelled"
},
"reservenotes": {
"type": ["string", "null"],
"description": "notes related to this hold"
},
"priority": {
"type": ["integer", "null"],
"description": "where in the queue the patron sits"
},
"found": {
"type": ["string", "null"],
"description": "a one letter code defining what the status of the hold is after it has been confirmed"
},
"timestamp": {
"type": ["string", "null"],
"description": "date and time the hold was last updated"
},
"itemnumber": {
"$ref": "../x-primitives.json#/itemnumber"
},
"waitingdate": {
"type": ["string", "null"],
"description": "the date the item was marked as waiting for the patron at the library"
},
"expirationdate": {
"type": ["string", "null"],
"description": "the date the hold expires"
},
"lowestPriority": {
"type": "boolean",
"description": "Controls if the hold is given the lowest priority on the queue"
},
"suspend": {
"type": "boolean",
"description": "Controls if the hold is suspended"
},
"suspend_until": {
"type": ["string", "null"],
"description": "Date until which the hold has been suspended"
},
"itemtype": {
"type": ["string", "null"],
"description": "If record level hold, the optional itemtype of the item the patron is requesting"
}
}
}