Bugzilla – Attachment 54562 Details for
Bug 17008
REST API: Correct data types in Swagger
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17008: Fix current data types
Bug-17008-Fix-current-data-types.patch (text/plain), 7.55 KB, created by
Lari Taskula
on 2016-08-18 11:28:25 UTC
(
hide
)
Description:
Bug 17008: Fix current data types
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2016-08-18 11:28:25 UTC
Size:
7.55 KB
patch
obsolete
>From e7fd448746e08356baedda25c4c0369904c20b17 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Tue, 16 Aug 2016 13:37:29 +0300 >Subject: [PATCH] Bug 17008: Fix current data types > >This patch changes current Swagger definitions for patrons and holds to have >data types corresponding to column data types in their database tables. > >To test: >1. GET http://yourlibrary/api/v1/patrons/YYY where YYY is existing borrowernumber >2. Observe that numbers / integers are in string data type. >3. Apply this patch. >4. Repeat step 1. >5. Observe that numbers / integers are now actually numbers / integers. >--- > Koha/REST/V1/Hold.pm | 12 ++++++------ > Koha/REST/V1/Patron.pm | 4 ++-- > api/v1/definitions/hold.json | 20 +++++++++++++++++--- > api/v1/definitions/patron.json | 16 ++++++++-------- > 4 files changed, 33 insertions(+), 19 deletions(-) > >diff --git a/Koha/REST/V1/Hold.pm b/Koha/REST/V1/Hold.pm >index 7f0b1ff..9410396 100644 >--- a/Koha/REST/V1/Hold.pm >+++ b/Koha/REST/V1/Hold.pm >@@ -34,9 +34,9 @@ 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); >+ return $c->$cb($holds->swaggerize, 200); > } > > sub add { >@@ -106,9 +106,9 @@ sub add { > }, 500); > } > >- my $reserve = C4::Reserves::GetReserve($reserve_id); >+ my $reserve = Koha::Holds->find($reserve_id); > >- return $c->$cb($reserve, 201); >+ return $c->$cb($reserve->swaggerize, 201); > } > > sub edit { >@@ -138,9 +138,9 @@ sub edit { > 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); >+ return $c->$cb($reserve->swaggerize, 200); > } > > sub delete { >diff --git a/Koha/REST/V1/Patron.pm b/Koha/REST/V1/Patron.pm >index 2851308..042a24b 100644 >--- a/Koha/REST/V1/Patron.pm >+++ b/Koha/REST/V1/Patron.pm >@@ -32,7 +32,7 @@ sub list { > > my $patrons = Koha::Patrons->search; > >- $c->$cb($patrons->unblessed, 200); >+ $c->$cb($patrons->swaggerize, 200); > } > > sub get { >@@ -52,7 +52,7 @@ sub get { > return $c->$cb({error => "Patron not found"}, 404); > } > >- return $c->$cb($patron->unblessed, 200); >+ return $c->$cb($patron->swaggerize, 200); > } > > 1; >diff --git a/api/v1/definitions/hold.json b/api/v1/definitions/hold.json >index 620187e..5fd8b7a 100644 >--- a/api/v1/definitions/hold.json >+++ b/api/v1/definitions/hold.json >@@ -2,17 +2,19 @@ > "type": "object", > "properties": { > "reserve_id": { >+ "type": "integer", > "description": "Internal hold identifier" > }, > "borrowernumber": { >- "type": "string", >+ "type": "integer", > "description": "internally assigned user identifier" > }, > "reservedate": { >+ "type": ["string", "null"], > "description": "the date the hold was placed" > }, > "biblionumber": { >- "type": "string", >+ "type": "integer", > "description": "internally assigned biblio identifier" > }, > "branchcode": { >@@ -20,43 +22,55 @@ > "description": "internally assigned branch identifier" > }, > "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", > "description": "date and time the hold was last updated" > }, > "itemnumber": { >- "type": ["string", "null"], >+ "type": ["integer", "null"], > "description": "internally assigned item identifier" > }, > "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": "integer", > "description": "" > }, > "suspend": { >+ "type": "integer", > "description": "" > }, > "suspend_until": { >+ "type": ["string", "null"], > "description": "" > }, > "itemtype": { >diff --git a/api/v1/definitions/patron.json b/api/v1/definitions/patron.json >index 8e7d08b..fcf9008 100644 >--- a/api/v1/definitions/patron.json >+++ b/api/v1/definitions/patron.json >@@ -2,7 +2,7 @@ > "type": "object", > "properties": { > "borrowernumber": { >- "type": "string", >+ "type": "integer", > "description": "internally assigned user identifier" > }, > "cardnumber": { >@@ -146,11 +146,11 @@ > "description": "date the patron's card is set to expire" > }, > "gonenoaddress": { >- "type": ["string", "null"], >+ "type": ["integer", "null"], > "description": "set to 1 if library marked this patron as having an unconfirmed address" > }, > "lost": { >- "type": ["string", "null"], >+ "type": ["integer", "null"], > "description": "set to 1 if library marked this patron as having lost his card" > }, > "debarred": { >@@ -174,7 +174,7 @@ > "description": "used for children to include title of guarantor" > }, > "guarantorid": { >- "type": ["string", "null"], >+ "type": ["integer", "null"], > "description": "borrowernumber used for children or professionals to link them to guarantor or organizations" > }, > "borrowernotes": { >@@ -194,7 +194,7 @@ > "description": "patron's encrypted password" > }, > "flags": { >- "type": ["string", "null"], >+ "type": ["integer", "null"], > "description": "a number associated with the patron's permissions" > }, > "userid": { >@@ -258,15 +258,15 @@ > "description": "the mobile phone number where the patron would like to receive notices (if SMS turned on)" > }, > "sms_provider_id": { >- "type": ["string", "null"], >+ "type": ["integer", "null"], > "description": "the provider of the mobile phone number defined in smsalertnumber" > }, > "privacy": { >- "type": "string", >+ "type": "integer", > "description": "patron's privacy settings related to their reading history" > }, > "privacy_guarantor_checkouts": { >- "type": "string", >+ "type": "integer", > "description": "controls if relatives can see this patron's checkouts" > }, > "checkprevcheckout": { >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17008
:
54486
|
54502
|
54508
|
54509
|
54510
|
54561
|
54562
|
54563
|
56247
|
56248
|
56249
|
56250
|
56251
|
56279
|
56280
|
56281
|
57352
|
57353
|
57354
|
57355