Giter VIP home page Giter VIP logo

personal-library-manager's Introduction

Personal-library-manager

A way to record and manage your personal library.

How to run application

  • Pull this repository down
  • cd into server folder
  • npm install packages
  • npm run start to start server im a different terminal:
  • cd into client folder
  • npm install packages
  • npm run start to start client

How to run tests

Currently there a couple of unit tests on the client side of the application. to run them:

  • cd into client folder
  • npm run test

Routes

GET /books - get all the books POST /books - create a new book GET books/:id - get a single book page PATCH: book/:id - edit a books details DELETE: book/:id - delete a book

Future features to work on

The following are ways the app can be improved:

[] Pagination [] images to show up in thumbnail within individual book page [] delete image from uploads folder when book is deleted [] indication in book card of loan status [] configure 404 response better (more consistently in backend and on individual pages on frontend) [] component to indicate that there are no books in the library

personal-library-manager's People

Contributors

deb0890 avatar

Watchers

 avatar

Forkers

iamdanielcooper

personal-library-manager's Issues

Logic

const { booktitle, authorfirstname, authorlastname, genreone, genretwo } =

Here we destructure but would it be easier to pass this entire object into Book.create()?
We could just set default values for borrower dateBorrowed dateBorrowed in the model.

Then this would be a bit cleaner and look like Book.create(req.body, imagePath)

Library page - form

The two options for the form:

  • display as a modal
  • only displayed on page when button is clicked

Include the following fields:

  • Title (text field)
  • Author (text field)
  • Genre (dropdown)
  • Image?
  • Editable?
  • delete button (or archive maybe?)

Styling

Library page - book list

Related to appending information from form to the list (library)
Books show as narrow card on the page with book title, author name and when clicked on more information is shown (modal?).

Styling

Logic question

const book = await Book.findOneAndDelete({ _id: id });

Should we try to delete a book we don't know exists?

In my mind, the flow should be.

  • Verify id is valid
  • Verify user has a book with this id
  • Delete the book

Then we could reformat like this.

const deleteBook = async (req, res) => {
  const { id } = req.params;

  if (!isValidId(id)) {
      return res.status(404).json({ error: "No such book in your library!" });
  } else if (Book.hasBook(id) {
      const book = await Book.findOneAndDelete({ _id: id });
      res.status(200).json(book);
  } else {
      return res.status(404).json({ error: "No such book in your library!" });
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.