{"id":25185849,"url":"https://github.com/mazensayed91/library-management-system","last_synced_at":"2025-04-04T08:43:47.863Z","repository":{"id":197453225,"uuid":"697669240","full_name":"Mazensayed91/Library-Management-System","owner":"Mazensayed91","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-30T15:33:13.000Z","size":173,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T19:43:13.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mazensayed91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-28T08:27:25.000Z","updated_at":"2023-09-30T15:38:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"9295e9f7-05f9-48d3-918c-e947c6ab024e","html_url":"https://github.com/Mazensayed91/Library-Management-System","commit_stats":null,"previous_names":["mazensayed91/library-management-system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2FLibrary-Management-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2FLibrary-Management-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2FLibrary-Management-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2FLibrary-Management-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mazensayed91","download_url":"https://codeload.github.com/Mazensayed91/Library-Management-System/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149459,"owners_count":20891949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-09T19:40:36.015Z","updated_at":"2025-04-04T08:43:47.835Z","avatar_url":"https://github.com/Mazensayed91.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library Management System\n\n## Technology Stack\n\n- Node.js\n- Express.js\n- Sequelize (ORM for interacting with the database)\n- SQLite (Database)\n- JSON Web Tokens (JWT) for authentication\n- Rate limiting for API endpoints\n- Jest for unit testing\n\n## Prerequisites\n\n- Node.js and npm (Node Package Manager) installed on your system.\n- A code editor (e.g., Visual Studio Code).\n- Postman or a similar tool for API testing.\n\n## Getting Started\n\n1. **Clone the repository:**\n   ```bash\n   https://github.com/Mazensayed91/Library-Management-System.git\n   \n2. **Navigate to the project directory:**\n\n   ```bash\n   cd Library-Management-System\n\n3. **Install dependencies:**\n\n   ```bash\n   npm install\n\n4. **Start the server:**\n\n   ```bash\n   npm start\n\nThe server should now be running on http://localhost:3000.\n\n\n## API Reference\n\n### Base URL\n\n- Base URL: `http://localhost:3000/api`\n\n### Error Handling\n\n- The API follows standard HTTP status codes for error handling.\n- In case of an error, you will receive a JSON response with an error message.\n\n### Endpoints\n\n#### Books\n\n### GET /books\n\n**Description:** Retrieve a list of all books.\n\n**Input:** \n**Query Parameters:**\n- page (optional): Page number for pagination (default: 1).\n- limit (optional): Number of records per page (default: 10).\n\n**Output:**\n\n```json\n{\n    \"success\": true,\n    \"data\": [\n        {\n            \"id\": 1,\n            \"title\": \"Mazen's Book 2\",\n            \"author\": \"Mazon\",\n            \"isbn\": \"444-233242\",\n            \"quantity\": 10,\n            \"shelfLocation\": \"A1\",\n            \"createdAt\": \"2023-09-29T11:59:25.172Z\",\n            \"updatedAt\": \"2023-09-29T11:59:25.172Z\"\n        },\n        {\n            \"id\": 2,\n            \"title\": \"Mazen's Book 2\",\n            \"author\": \"Mazon\",\n            \"isbn\": \"444-233242\",\n            \"quantity\": 10,\n            \"shelfLocation\": \"A1\",\n            \"createdAt\": \"2023-09-29T11:59:25.462Z\",\n            \"updatedAt\": \"2023-09-29T11:59:25.462Z\"\n        },\n        {\n            \"id\": 3,\n            \"title\": \"Mazen's Book 2\",\n            \"author\": \"Mazon\",\n            \"isbn\": \"444-233242\",\n            \"quantity\": 10,\n            \"shelfLocation\": \"A1\",\n            \"createdAt\": \"2023-09-29T12:15:22.786Z\",\n            \"updatedAt\": \"2023-09-29T12:15:22.786Z\"\n        }\n    ],\n    \"pagination\": {\n        \"totalRecords\": 3,\n        \"currentPage\": 1,\n        \"perPage\": 3\n    }\n}\n```\n### GET /books/:id\n\n**Description:** Retrieve information about a specific book.\n\n**Input:** Book ID (e.g., /books/1)\n\n**Output:**\n\n```json\n{\n    \"id\": 1,\n    \"title\": \"Mazen's Book 2\",\n    \"author\": \"Mazon\",\n    \"isbn\": \"444-233242\",\n    \"quantity\": 10,\n    \"shelfLocation\": \"A1\",\n    \"createdAt\": \"2023-09-28T15:52:25.336Z\",\n    \"updatedAt\": \"2023-09-28T15:52:25.336Z\"\n}\n```\n\n### POST /books\n\n**Description:** Create a new book.\n\n**Input:**\n\n```json\n{\n  \"title\": \"Mazen's Book 2\",\n  \"author\": \"Mazon\",\n  \"isbn\": \"444-233242\",\n  \"quantity\": 10,\n  \"shelfLocation\": \"A1\"\n}\n\n```\n\n#### PUT /books/:id\n\n**Description:** Update information for a specific book.\n\n**Input:**\n\n```json\n{\n  \"title\": \"Updated Book Title\",\n  \"quantity\": 5\n}\n```\n\n#### DELETE /books/:id\n\n**Description:** Delete a specific book.\n\n**Input:** Book ID (e.g., /books/3)\n\n\n#### Borrowers\n\n- **GET /borrowers**: Retrieve a list of all borrowers.\n**Input:** \n**Query Parameters:**\n- page (optional): Page number for pagination (default: 1).\n- limit (optional): Number of records per page (default: 10).\n  \n**Output:**\n  ```json\n   {\n    \"success\": true,\n    \"data\": [\n        {\n            \"id\": 1,\n            \"name\": \"Mazen Sayed 2\",\n            \"email\": \"mazensayed@example.com\",\n            \"registeredDate\": \"2023-09-28T00:00:00.000Z\",\n            \"createdAt\": \"2023-09-29T11:59:41.480Z\",\n            \"updatedAt\": \"2023-09-29T11:59:41.480Z\"\n        },\n        {\n            \"id\": 2,\n            \"name\": \"Mazen Sayed 2\",\n            \"email\": \"mazensay3ed@example.com\",\n            \"registeredDate\": \"2023-09-28T00:00:00.000Z\",\n            \"createdAt\": \"2023-09-29T11:59:58.399Z\",\n            \"updatedAt\": \"2023-09-29T11:59:58.399Z\"\n        },\n        {\n            \"id\": 3,\n            \"name\": \"Mazen Sayed 2\",\n            \"email\": \"mazensay3hd@example.com\",\n            \"registeredDate\": \"2023-09-28T00:00:00.000Z\",\n            \"createdAt\": \"2023-09-29T12:22:50.173Z\",\n            \"updatedAt\": \"2023-09-29T12:22:50.173Z\"\n        }\n    ],\n    \"pagination\": {\n        \"totalRecords\": 3,\n        \"currentPage\": 1,\n        \"perPage\": 3\n    }\n}\n```\n- **GET /borrowers/:id**: Retrieve information about a specific borrower.\n  \n- **POST /borrowers**: Create a new borrower.\n**Input**\n```json\n{\n  \"name\": \"Mazen Sayed 2\",\n  \"email\": \"mazensayed@example.com\",\n  \"registeredDate\": \"2023-09-28\" \n}\n```\n**Output**\n```json\n{\n    \"id\": 3,\n    \"name\": \"Mazen Sayed 2\",\n    \"email\": \"mazensay3hd@example.com\",\n    \"registeredDate\": \"2023-09-28T00:00:00.000Z\",\n    \"updatedAt\": \"2023-09-29T12:22:50.173Z\",\n    \"createdAt\": \"2023-09-29T12:22:50.173Z\"\n}\n```\n\n#### DELETE /borrowers/:id: Delete a specific borrower.\n**Input:** Borrower ID (e.g., /borrowers/1)\n\n#### PUT /borrowers/:id: Update information for a specific borrower.\n\n\n#### Checkout\n\n- **GET /checkout/overdue-books**: Retrieve a list of overdue books.\n**Output**\n  ``` json\n  [\n    {\n        \"id\": 2,\n        \"bookId\": 1,\n        \"borrowerId\": 2,\n        \"checkoutDate\": \"2023-09-29T12:07:32.963Z\",\n        \"dueDate\": \"2023-09-29T12:07:32.963Z\",\n        \"returned\": false,\n        \"createdAt\": \"2023-09-29T12:07:32.966Z\",\n        \"updatedAt\": \"2023-09-29T12:07:32.966Z\",\n        \"Book\": {\n            \"id\": 1,\n            \"title\": \"Mazen's Book 2\",\n            \"author\": \"Mazon\",\n            \"isbn\": \"444-233242\",\n            \"quantity\": 10,\n            \"shelfLocation\": \"A1\",\n            \"createdAt\": \"2023-09-28T15:52:25.336Z\",\n            \"updatedAt\": \"2023-09-28T15:52:25.336Z\"\n          }\n      }\n  ]\n\n- **POST /checkout**: Create a new checkout record.\n**Input**\n```json\n{\n  \"bookId\": 1,\n  \"borrowerId\": 2\n}\n```\n**Output**\n```json\n{\n    \"message\": \"Book checked out successfully\"\n}\n```\n\n#### Reports\n\n- **GET /report/generate-periodic-borrowing-report**: Generate a CSV report for the borrowing process in a specific period.\n- **GET /report/generate-overdue-borrows-csv-report**: Generate a CSV report for overdue borrows.\n- **GET /report/generate-last-month-borrowing-csv-report**: Generate a CSV report for borrowing processes in the last month.\n\n### Database Schema\n\n- The application uses an SQLite database with the following schema assuming user in a seprate diagram:\n\n  ![image](https://github.com/Mazensayed91/Library-Management-System/assets/54520113/276693ea-0605-4fd9-b1cd-f0e2505a2e72)\n\n\n  - **Books**: Contains information about books.\n  - **Borrowers**: Contains information about borrowers.\n  - **Checkout**: Contains records of book checkouts.\n  - **User**: Contains the user's data used for auth.\n\n### Application Unit Testing\n\n| UnitTest                                  |                  Description                     |         Expected Return           |\n| ------------------------------------------| -------------------------------------------------|-----------------------------------|\n|book.test.js                               | Create Book                                      |             201                   |\n|book.test.js                               | Create Book without title                        |     SequelizeValidationError      |\n\n- Unit tests for the application can be run using the following command:\n\n  ```bash\n  npm test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazensayed91%2Flibrary-management-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmazensayed91%2Flibrary-management-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazensayed91%2Flibrary-management-system/lists"}