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.
- Creating restful apis using nodejs, nestjs, postgres and typeorm.
- Writing unit testing using jest.
- Dockerizing the app using docker-compose.
Make sure you have the following installed:
- Docker
- Docker Compose
-
Clone the repository:
-
Build and start the application using Docker Compose:
docker-compose up --build
-
Access the application at:
- Endpoint:
GET /books
- Description: Retrieves a list of all books.
- Responses:
- 200 OK: Returns an array of book objects.
- Endpoint:
POST /books
- Description: Creates a new book.
- Request Body:
{ "title": "string", "author": "string", "publishedDate": "string", "availableQuantity": "number" }
- Endpoint:
PATCH /books
- Description: updates an existing book.
- Request Body:
{ "id": 1, "title": "string", "author": "string", "publishedDate": "string", "availableQuantity": "number" } }
- Endpoint:
GET /borrowers
- Description: Retrieves a list of all borrowers.
- Responses:
- 200 OK: Returns an array of borrower objects.
- Endpoint:
POST /borrowers
- Description: Creates a new borrower.
- Request Body:
{ "name": "string", "email": "string" }
- Endpoint:
PATCH /borrowers
- Description: updates an existing borrower details.
- Request Body:
{ "id": 1, "name": "", "email": "" }
- 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 }
- Endpoint:
POST /borrowing-transactions/return/:transactionId
- Description: returns a book from a borrower back to the library.
- Request Body:
{ "transactionId": 5 }