Skip to content

droidthings/Library_Management-ReactJS_NodeJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Library_Management-ReactJS_NodeJS

A simple library management module developed with ExpressJS and MySQL with ReactJS as front-end

Techonologies used in this application

Front-end

  1. ReactJS
  2. Semantics UI
  3. React-Bootstrap

Back-end

  1. MySQL
  2. Express.js
  3. Node.js

Install dependencies

Open a git bash or a command line into each client/server folder. Run npm install command to install all required node modules and other UI dependencies.

Install MySQL

Install MySQL from here. Create database with the name of your choice. Change the database configurations here

###Run Application Once all the dependencies are installed navigate inside client/server folders. Run npm start commands to run the individual applications.

Functionalitites

The whole project has been divided into 2 modules

  • Admin
  • User

Admin module functionalities

  • Login (For the purpose of this assignment login for user/admin is hardcoded. Few of the users are created on database using MySQL commnd line for client console directly.)
  • Add books

User module functionalities

  • Login
  • View books
  • Borrow Books (Based on the use cases in the assignment)
  • Return Book

API Routes

POST : /api/login API routes for users and admin to login to the application

POST : /api/books/addBook (name, author, publisher, quantity) An API route that allow admins to add new book:

GET : /api/books/getAllBooks An API route that allow users and admins to get all books in the library

POST : /api/books/borrowBook (email, book_id, quantity) An API route that allow users to borrow a book in the library

GET : /api/books/getAllUserBooks?email=email_id An API route that allow users to get all the books that the user has borrowed but has not returned

POST : /api/books/returnBook (email, book_id, quantity) An API route that allow user to return a book

###Approach The project contains two tables on the database. One for the user management and another for maintaining books in the library. The user table has isAdmin bit in order to classsify the user as admin or user. Based on this flag different home screens are loaded. Admin page shows a form to add books and a table to view all books. In contrast, home screen for a user shows availbale books in the library. User has given option to view his borrowed books by navigating to the My List from the top right dropdown.

Books table has columns such as name of the book, author, publisher and quantity available in the library. This table is updated based on the operations performed by the user such as reducing the quantity of a borrowed book. Further, a new table borrowedbooks table is maintained in order to track borrowed books. When user borrows a book, the quantity is reduced from books table and simultaneously inserted into borrowedbooks table. Similarly when user returns a book, the qunatity is increased from books table and removed from borrowedbooks table. Using the life cycle methods provided ny ReactJS framework the home screen interfaces are updated regularly whenever an event occurs. The borrowedbooks table can further be used to get all the borrowed books by the user by joining it with books table based on user_id.

Rather than focussing on writing unit test cases, the project provides a comprehensive user interface designed using modular ReactJS components. The same use cases can be performed for multiple users also.

Screenshots

No books found in the library User page Admin page sql_borrowed_empty

Admin adding all books Admin page

Books table after adding all book, please observe number of book sql_books

User viewing all books user_all_books

User borrows a book i.e first book, the quantity of the book from library should be reduced user_borrow_and_reduce

User tries to borrow the same copy of book user_already_borrowed

User borrows a second different book user_second_book

User tries to borrow more books after renting 2 books user_already_borrowed_2_books

Books table after a user borrows 2 different books sql_borrowed_books

After the books are borrowed the back-end application maintains another table to track the borrowed books sql_from_borrowed_table

Navigate to user screen to borrow all books from option on the top-right corner navigate_to_user

User borrowed books are obtained using joining the books table with borrowedbooksUser with JOIN query based on the user_id returns all books to library using the return button, when all the books are retured, the API return a proper status message. return_book_1 return_book_2

After all the books are returned the books table returns back to its initial state and borrowedbook table is ideally cleared sql_after_retun_all

About

A simple library management module developed with ExpressJS and MySQL with ReactJS as front-end

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published