ulsdevteam / lcsu

0 stars 0 forks source link

query parameter or restful parameter? #6

Closed ctgraham closed 5 years ago

ctgraham commented 5 years ago

I haven't see the calling source yet, but the method bookList() certainly appears to take an undocumented parameter of the tray in order to scope the list of books.

https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/BooksController.php#L188-L198

This should probably be implemented as a RESTful URI, with the tray_id as a URI and method argument, rather than as magically grabbing the tray_id from the querystring.

Additionally, since this (and the deleteBooksByTray() method) are receiving the Tray as a parameter, they probably should be Tray methods, rather than Book methods.

https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/BooksController.php#L200-L208

Conceptually, the REST call is probably something like application/Tray/<trayId>/listBooks or application/Tray/<trayId>/deleteBooks.

edensung25 commented 5 years ago

I figured out that these two functions are redundant. I used booklist in scan_list.ctp called by vue.js to initial the book list table. I moved this part to trayController/scanList, and deleteBooksByTray is an orphan function. So, I deleted those functions.