Skip to content

A simple library management system to manage books and borrowers.

License

Notifications You must be signed in to change notification settings

Tassneem04Hamdy/library-management-system

Repository files navigation

Library Management System

A simple library management system that manage books and borrowers.


Used Technologies


Running the server

  1. To run the server, the first step is to download and install NodeJS and Postgresql on your machine.

  2. Run the database script in the database.sql file.

  3. Open a terminal, navigate to the project's directory, and run the following command to install the needed packages:

npm i
  1. Create a .env file in the project's root directory and fill in the data according to the .env.example file.

  2. Now, run the server through:

npm start

API Endpoints

HTTP Method Endpoint Required fields Optional fields Action Response
POST /auth/signUp - libraryName: string
- username: string
- password: string
None SignUp - Created libraryAdmin object
POST /auth/signIp - username: string
- password: string
None SignIn - username and libraryName
- jwt access token in auth-token header

Note: The following endpoints require an access token (bearer token)

HTTP Method Endpoint Required fields Optional fields Action Response
POST /books - isbn: string
- title: string
- author: string
- availableQuantity: number
- shelfLocation: string
None Add Book - The created book object
PATCH /books/:bookIsbn None - title: string
- author: string
- availableQuantity: number
- shelfLocation: string
Edit Book - The updatedBook object
DELETE /books/:bookIsbn None None Delete Book - 'Book with ISBN: ${bookIsbn} is successfully deleted' message
GET /books/?title=<>&author=<>&isbn=<> None None Get all Library Books OR Specific One Depending on Optional Query Parameters - Array of books data
POST /borrowers - nid: string
- name: string
- email: string Register a Borrower - The created borrower object
PATCH /borrowers/:borrowerId None - name: string
- email: string
Edit Borrower - The updatedBorrower object
DELETE /borrowers/:borrowerId None None Delete Borrower - 'Borrower with ID: ${borrowerId} is successfully deleted' message
GET /borrowers None None Get all Library Borrowers - borrowers array
POST /borrowings/borrowers/:borrowerId/books/:bookIsbn None None Add Book to Borrower's Borrowings - The created borrowing and updatedBook objects
DELETE /borrowings/borrowers/:borrowerId/books/:bookIsbn None None Remove Book from Borrower's Borrowings - 'Borrowed book is successfully returned' message
GET /borrowings/borrowers/:borrowerId None None Get All Borrowings of Specific Borrower - borrowings array
GET /borrowings/overdue - dueDaysNum None Get All Books that are Overdue - overdueBorrowings array

Returned objects format

Note: optional fields could be undefined

libraryAdmin = {
	library_id,
	library_name,
	admin_id,
	username
}
{
	username,
    libraryName
}
book = {
    isbn,
    title,
    author,
    available_quantity,
    library_id,
    shelf_location
}
updatedBook = {
    isbn,
    title,
    author,
    available_quantity,
    library_id,
    shelf_location
}
data = [
    {
        isbn,
        title,
        author,
        available_quantity,
        library_id,
        shelf_location
    },
    etc...
]
borrower = {
    borrower_id,
    nid,
    name,
    email,
    library_id,
    registered_date
}
updatedBorrower = {
    borrower_id,
    nid,
    name,
    email,
    library_id,
    registered_date
}
borrowers = [
    {
        borrower_id,
        nid,
        name,
        email,
        library_id,
        registered_date
    },
    etc...
]
borrowing = {
    borrowing_id,
    borrower_id,
    book_isbn,
    library_id,
    borrowing_date
}
borrowings = [
    {
        borrowing_id,
        borrower_id,
        book_isbn,
        library_id,
        borrowing_date
    },
    etc...
]
overdueBorrowings = [
    {
        borrowing_id,
        borrower_id,
        book_isbn,
        library_id,
        borrowing_date
    },
    etc...
]

License

The back-end is available under the MIT License.

About

A simple library management system to manage books and borrowers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published