Skip to content

MahmoudAdelkamal/Bosta-backend-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 

Repository files navigation

Library Management System

Overview

The Library management System is an application that allows users to manage books, including adding new books, updating book details, borrowing books and returning them back.

Features implemented :

  1. Creating restful apis using nodejs, nestjs, postgres and typeorm.
  2. Writing unit testing using jest.
  3. Dockerizing the app using docker-compose.

Prerequisites

Make sure you have the following installed:

  • Docker
  • Docker Compose

Installation

Installation using Docker

  1. Clone the repository:

  2. Build and start the application using Docker Compose:

    • docker-compose up --build
  3. Access the application at:

API Documentation

Books API

API Documentation for Book Section

1. Get All Books

  • Endpoint: GET /books
  • Description: Retrieves a list of all books.
  • Responses:
    • 200 OK: Returns an array of book objects.

2. Create a Book

  • Endpoint: POST /books
  • Description: Creates a new book.
  • Request Body:
    {
      "title": "string",
      "author": "string",
      "publishedDate": "string",
      "availableQuantity": "number"
    }
    
    
    

3. update a Book

  • Endpoint: PATCH /books
  • Description: updates an existing book.
  • Request Body:
    {
      "id": 1,
      "title": "string",
      "author": "string",
      "publishedDate": "string",
      "availableQuantity": "number"
    }
    }
    
    

Borrower API

API Documentation for Borrower Section

1. Get All Borrowers

  • Endpoint: GET /borrowers
  • Description: Retrieves a list of all borrowers.
  • Responses:
    • 200 OK: Returns an array of borrower objects.

2. Create a Borrower

  • Endpoint: POST /borrowers
  • Description: Creates a new borrower.
  • Request Body:
    {
      "name": "string",
      "email": "string"
    }

3. update a Borrower

  • Endpoint: PATCH /borrowers
  • Description: updates an existing borrower details.
  • Request Body:
    {
      "id": 1,
       "name": "",
       "email": ""
    }
    
    

API Documentation for Borrowing Transaction Section

1. Checkout a Book

  • Endpoint: POST /borrowing-transactions/checkout
  • Description: Checks out a book for a borrower.
  • Request Body:
    {
      "borrowerId": "number",
      "bookId": "number",
      "dueDate": "2024-10-20"  // Format: YYYY-MM-DD
    }
    

2. Return a Book

  • Endpoint: POST /borrowing-transactions/return/:transactionId
  • Description: returns a book from a borrower back to the library.
  • Request Body:
    {
       "transactionId": 5
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published