{"id":29054210,"url":"https://github.com/mahimdev/mongodb-b5a3","last_synced_at":"2025-08-24T03:36:26.154Z","repository":{"id":300281343,"uuid":"1005776958","full_name":"mahimDev/mongodb-b5a3","owner":"mahimDev","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-20T20:01:07.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-28T00:12:50.934Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/mahimDev.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-20T19:54:23.000Z","updated_at":"2025-06-20T20:01:10.000Z","dependencies_parsed_at":"2025-06-20T21:02:46.687Z","dependency_job_id":null,"html_url":"https://github.com/mahimDev/mongodb-b5a3","commit_stats":null,"previous_names":["mahimdev/mongodb-b5a3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mahimDev/mongodb-b5a3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahimDev%2Fmongodb-b5a3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahimDev%2Fmongodb-b5a3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahimDev%2Fmongodb-b5a3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahimDev%2Fmongodb-b5a3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahimDev","download_url":"https://codeload.github.com/mahimDev/mongodb-b5a3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahimDev%2Fmongodb-b5a3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271786184,"owners_count":24820630,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-06-27T02:06:50.412Z","updated_at":"2025-08-24T03:36:26.113Z","avatar_url":"https://github.com/mahimDev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📚 Library Management System API\n\nThis is a Library Management System backend built with **Express**, **TypeScript**, and **MongoDB (Mongoose)**.\n\n## 🚀 Features\n\n- Add, update, delete, and retrieve books\n- Borrow books with quantity \u0026 due date\n- Auto-update availability based on copies\n- Summary of all borrowed books (with aggregation)\n- Mongoose validation, static methods, and middleware used\n- Filtering, sorting, and pagination support\n\n## 📦 Technologies Used\n\n- Node.js + Express\n- TypeScript\n- MongoDB with Mongoose\n- ts-node-dev for development\n\n## 🛠️ Setup Instructions\n\n1. **Clone the repository**\n\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd assignment-3\n```\n\n2. **Install dependencies**\n\n```bash\nnpm install\n```\n\n3. **Create `.env` file**\n\n```env\nPORT=5000\nMONGODB_URI=mongodb://localhost:27017/library-api\n```\n\n4. **Run the development server**\n\n```bash\nnpm run dev\n```\n\n## 📁 API Endpoints\n\n### 📘 Books\n\n#### ➕ Create Book\n\n`POST /api/books`\n\n```json\n{\n  \"title\": \"The Theory of Everything\",\n  \"author\": \"Stephen Hawking\",\n  \"genre\": \"SCIENCE\",\n  \"isbn\": \"9780553380163\",\n  \"description\": \"An overview of cosmology and black holes.\",\n  \"copies\": 5\n}\n```\n\n#### 📚 Get All Books (with filters)\n\n`GET /api/books?filter=FANTASY\u0026sortBy=createdAt\u0026sort=desc\u0026limit=5`\n\n#### 📖 Get Book by ID\n\n`GET /api/books/:bookId`\n\n#### ✏️ Update Book\n\n`PUT /api/books/:bookId`\n\n```json\n{\n  \"copies\": 10\n}\n```\n\n#### ❌ Delete Book\n\n`DELETE /api/books/:bookId`\n\n---\n\n### 📗 Borrow\n\n#### ➕ Borrow a Book\n\n`POST /api/borrow`\n\n```json\n{\n  \"book\": \"\u003cbookId\u003e\",\n  \"quantity\": 2,\n  \"dueDate\": \"2025-07-18\"\n}\n```\n\n#### 📊 Borrow Summary\n\n`GET /api/borrow`\n\n```json\n[\n  {\n    \"book\": { \"title\": \"The Theory of Everything\", \"isbn\": \"9780553380163\" },\n    \"totalQuantity\": 5\n  }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahimdev%2Fmongodb-b5a3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahimdev%2Fmongodb-b5a3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahimdev%2Fmongodb-b5a3/lists"}