-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hey guys, nice looking code, I just have a few comments -
I think you really need to break up your issues more, starting with the user stories.
As a User I want to be able to add, delete, edit and see books in my database
I guess this is your #4. Tasks (and therefore issues) this could logically be broken into:
- Show books:
- Make a
GETendpoint - this will use a select query to get all the book data and render all the books using a handlebars template
- You have pretty much already done this on the
GSG_library
- Make a
- Add a book:
- Make a
GET /add-bookendpoint. This will render a form to add a book to the database. The from willPOSTdata to another endpoint eg:/books - Make
POST /booksendpoint: Will take req.body from the post and add it to the books table using a query. Will probably just send back the id of the book you've added?
- Make a
- Delete a book:
- The view which shows all the books could have a delete button on each of the books, which when you click on it will make a request to an endpoint that includes that book's id (this should be easy to do in handlebars. The endpoint could be
books/:idand the request could be aDELETErequest DELETE /books/:id: Will delete the book with the id from the req.params
- The view which shows all the books could have a delete button on each of the books, which when you click on it will make a request to an endpoint that includes that book's id (this should be easy to do in handlebars. The endpoint could be
- Edit a book:
- Make a new end point
GET /edit-books/:id. This will render a form to edit a book. The form willPUTdata to another endpoint, eg/books/:id PUT /books/:id: Will take req.body from the post and update it to book with id from the req.params
- Make a new end point
I know you kind of have done this already, and you maybe already have all this planned out, but it is sooooo much easier for you to keep track of if you document these in issues.
As a User I want to be able to lend books to members
This is basically #3. I can't remember how this should work, but I would keep this seperate from the above user journey/view/template. I'm not going to go into the same amount of detail as above - I'll leave that for you, but something like:
- Make a new endpoint
/lendor something (think you have this planned already). - Serve up a new template here which can facilitate this lending - I imagine a search bar to search books. Once you click on a book, this should then let you add a member to lend to (maybe again by a search bar). When you click lend, this makes a database request to update the book in the db as lent to member with id whatever.
As a User I want to see what books have been lended to whom
Kind of similar to #2 I guess - for me #2 is too complicated. All that needs to happen for this story is to render a template that show's books that have been lent, and who to, and a button to send an email.
Again I know you have probably planned this out already, but I very much recommend thinking of all the different tasks you need to do just to complete the above journeys and write them out in issues.