Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes after a brief code review #24

Open
m4v15 opened this issue Jun 12, 2018 · 2 comments
Open

Notes after a brief code review #24

m4v15 opened this issue Jun 12, 2018 · 2 comments

Comments

@m4v15
Copy link

m4v15 commented Jun 12, 2018

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 GET endpoint
    • 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
  • Add a book:
    • Make a GET /add-book endpoint. This will render a form to add a book to the database. The from will POST data to another endpoint eg: /books
    • Make POST /books endpoint: 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?
  • 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/:id and the request could be a DELETE request
    • DELETE /books/:id: Will delete the book with the id from the req.params
  • Edit a book:
    • Make a new end point GET /edit-books/:id. This will render a form to edit a book. The form will PUT data 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

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 /lend or 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.

@ahmadmshatat
Copy link
Contributor

ahmadmshatat commented Jun 13, 2018

Thanls @m4v15 , Great Advises

@hshahwan
Copy link
Contributor

Thanks @m4v15 for your review, we will put into consideration,and I am already try to be more specific in issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants