Koha Test Wiki MediaWiki Postgres

One of a series of test instances for migrating the Koha Wiki MediaWiki database.

For the current Koha Wiki, visit https://wiki.koha-community.org .

Patrons endpoint RFC

From Koha Test Wiki MediaWiki Postgres

Jump to: navigation, search
Home
Koha > Technical > Development > RFCs

This RFC should be the basis for bug 19784 and related bug reports that could need to be filed.

Actions and routes

The following table presents the current implementation, and the proposed changes.

Description Action Current path Proposed path
List patrons
 GET
 /patrons
 /patrons
Add patron
 POST
 /patrons
 /patrons
Get a patron
 GET
 /patrons/{borrowernumber}
 /patrons/{patron_id}
Overwrite a patron
 PUT
 /patrons/{borrowernumber}
 /patrons/{patron_id}
Delete a patron
 DELETE
 /patrons/{borrowernumber}
 /patrons/{patron_id}
Partially update a patron
 PATCH
 NOT IMPLEMENTED
 /patrons/{patron_id}

Patron object definition

DB schema Current API tcohen Katrin
borrowernumberborrowernumberpatron_idpatron_id
cardnumbercardnumber
surnamesurname
firstnamefirstname
titletitle
othernamesothernames other_name
initialsinitials
streetnumberstreetnumberstreet_numberstreet_number
streettypestreettypestreet_typestreet_type
addressaddress
address2address2
citycity
statestate
zipcodezipcodezipzip_code If changed here, should be changed for B_zipcode and altcontactzipcode too.
countrycountry
emailemail
phonephone
mobilemobile
faxfax
emailproemailpro secondary_email or similar as there is nothing indicationg 'pro' or 'professional' in the GUI any longer.
phoneprophonepro secondary_phone
B_streetnumberB_streetnumber altaddress_streetnumber I think the same is true here, B has no meaning for us anymore. Should indicate somehow that this is 'alternate address' in the GUI.
B_streettypeB_streettype altaddress_streettype
B_addressB_address altaddress_address
B_address2B_address2 altaddress_address2
B_cityB_city altaddress_city
B_stateB_state altaddress_state
B_zipcodeB_zipcode altaddress_zip_code
B_countryB_country altaddress_country
B_emailB_email altaddress_email
B_phoneB_phone altaddress_phone
dateofbirthdateofbirth date_of_birth
branchcodebranchcodelibrary_id library_id
categorycodecategorycodecategory_id category_id
dateenrolleddateenrolleddate_enrolled date_enrolled
dateexpirydateexpiryexpiry_date expiry_date
date_reneweddate_renewed date_renewed
gonenoaddressgonenoaddress incorrect_address
lostlost patron_card_lost
NOT PRESENTNOT PRESENTrestricted (boolean,ro) ro = read only, use restrictions routes for more info. Ok for me.
debarreddebarredREMOVED Separate API?
debarredcommentdebarredcommentREMOVED Separate API?
contactnamecontactnamecontact_name [1] If this can't be used from GUI, should probably not be included in the API.
contactfirstnamecontactfirstnamecontact_firstnames [1] If this can't be used from GUI, should probably not be included in the API.
contacttitlecontacttitlecontact_titles [1] If this can't be used from GUI, should probably not be included in the API.
guarantoridguarantoridguarantor_id guarantor_id
borrowernotesborrowernotesnotes staff_notes
relationshiprelationship relationship_type
sexsex gender
passwordREMOVED
flagsflags staff_permissions
useriduserid
opacnoteopacnoteopac_notes opac_notes
contactnotecontactnotecontact_notes [1] contact_note
sort1sort1 statistics_1 The naming of this field is confusing in the GUI as well. Maybe we could think about something better.
sort2sort2 statistics_2
altcontactfirstnamealtcontactfirstname altcontact_firstname
altcontactsurnamealtcontactsurname altcontact_surname
altcontactaddress1altcontactaddress1 altcontact_address
altcontactaddress2altcontactaddress2 altcontact_address2
altcontactaddress3altcontactaddress3 altcontact_city
altcontactstatealtcontactstate altcontact_state
altcontactzipcodealtcontactzipcode altcontact_zip_code
altcontactcountryaltcontactcountry altcontact_country
altcontactphonealtcontactphone altcontact_phone
smsalertnumbersmsalertnumber sms_number
sms_provider_idsms_provider_id
privacyprivacy
privacy_guarantor_checkoutsprivacy_guarantor_checkouts
checkprevcheckoutcheckprevcheckout check_previous_checkout
updated_onupdated_on
lastseenlastseenlast_seen last_seen
langlang
login_attemptslogin_attempts
overdrive_auth_tokenoverdrive_auth_token
  • [1] This fields usage is not clearly defined through my code review. Comments from other devs is required (tcohen).

Notes

  • Debarments information is calculated and filled by Koha::Patron::Debarments. We shouldn't send the wrong message to API consumers that those fields can be updated through this endpoint. A /patrons/{patron_id}/restrictions endpoint needs to be added, and a boolean should be exposed on patron objects.
Personal tools