[x] Add Knex migration support (knexfile.js and migrations tables, added by #372)
[x] Add rentalItem table that relates to rental: contains barcode, returned, and rentalId
[x] Remove rental.returnDate and rental.barcode
[x] Rename rental.startDate to rental.start and rental.endDate to rental.end
[x] Update rental date validation triggers to use rentalItem
These triggers ensure that the rental startDate and endDate for each item don't conflict with any existing rentals for each item.
[x] Add external renter information to GET /rental and GET /rental/:rentalID
[x] Add GET /rental/:rentalID/item to return all items in a rental
Return all item info (brand, model, category) on this endpoint
[x] Add GET /rental/:rentalID/item/:barcode to get a specific item in a rental
[x] Add PUT /rental/:rentalID/item/:barcode to update a rental item's return date
[x] Add DELETE /rental/:rentalID/item/:barcode (admin only) to delete a rental item
[x] Change v2 PUT /rental to convert property names to match changed database schema (for backwards compatibility after breaking db change)
[x] Create v3 PUT /rental/:rentalId to use new column names
[x] Create v3 PUT /rental to insert array of items into rentalItem and use new column names
Breaking Change
knexfile.js
and migrations tables, added by #372)rentalItem
table that relates torental
: containsbarcode
,returned
, andrentalId
rental.returnDate
andrental.barcode
rental.startDate
torental.start
andrental.endDate
torental.end
rentalItem
These triggers ensure that the rentalstartDate
andendDate
for each item don't conflict with any existing rentals for each item.GET /rental
andGET /rental/:rentalID
GET /rental/:rentalID/item
to return all items in a rentalGET /rental/:rentalID/item/:barcode
to get a specific item in a rentalPUT /rental/:rentalID/item/:barcode
to update a rental item's return dateDELETE /rental/:rentalID/item/:barcode
(admin only) to delete a rental itemPUT /rental
to convert property names to match changed database schema (for backwards compatibility after breaking db change)PUT /rental/:rentalId
to use new column namesPUT /rental
to insert array of items intorentalItem
and use new column names