{"id":21314712,"url":"https://github.com/rohit1kumar/bug-free-potato","last_synced_at":"2025-03-15T21:23:03.010Z","repository":{"id":60204909,"uuid":"541488802","full_name":"rohit1kumar/bug-free-potato","owner":"rohit1kumar","description":"API that takes an excel file as input, parses it and stores the data in the database ","archived":false,"fork":false,"pushed_at":"2022-09-29T19:07:25.000Z","size":359,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T10:23:46.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pet.up.railway.app/","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/rohit1kumar.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}},"created_at":"2022-09-26T08:44:45.000Z","updated_at":"2022-09-29T17:22:27.000Z","dependencies_parsed_at":"2023-01-19T00:31:23.300Z","dependency_job_id":null,"html_url":"https://github.com/rohit1kumar/bug-free-potato","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fbug-free-potato","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fbug-free-potato/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fbug-free-potato/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fbug-free-potato/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohit1kumar","download_url":"https://codeload.github.com/rohit1kumar/bug-free-potato/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243791136,"owners_count":20348423,"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":"2024-11-21T18:15:08.599Z","updated_at":"2025-03-15T21:23:02.987Z","avatar_url":"https://github.com/rohit1kumar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pet API\n\n## API that takes an excel file as input, parses it and stores the data in the database and returns the data in JSON format.\n**Deployed on [Railway](https://pet.up.railway.app/). Test the endpoints on [Swagger](https://pet.up.railway.app/)**\n\n### Tools/Libraries used :\n    multer  -  To upload the excel file\n    xlsx    -  To parse the excel file\n\n### Implementation :\n    1.  The excel file is uploaded using multer\n    2.  The excel file is parsed using xlsx into a JSON object\n    3.  The data is stored in the database\n    4.  The data is returned in JSON format\n---\n\n\n## Steps to run the code :\n\n### Clone the repository\n    $ git clone https://github.com/rohit1kumar/bug-free-potato.git\n\n### Install dependencies \u0026 run\n    $ cd bug-free-potato\n    $ npm install \u0026\u0026 npm start\n\n### Go to http://localhost:3000/ to see the app running.\n\n*Note: choose local server from the dropdown as given below to test API in swagger*\n\u003cbr\u003e\n\u003cimg src=\"https://i.imgur.com/MDgGNJY.png\" width=\"400\" height=\"200\"\u003e\n\n---\n\n## API Endpoints\n\n**POST /api/v1/pet**\n- Add pet data to the database\n\nRequest Body:\n\n- Upload the excel file using postman as `form-data` with key as `file` by selecting file option in postman.\n\nResponse Body:\n\n```\n    {\n        \"status\": \"success\",\n        \"message\": \"Data added successfully\"\n    }\n ```\n\n**GET /api/v1/pet**\n\n- Get all the pet's data, with the following query parameters:\n    - `name`- Name of the pet\n    - `type`- Type of the pet\n    - `breed`- Breed of the pet\n    - `age`- Age of the pet\n\n    - `page` - Page number (default: 1)\n    - `limit` - Number of items per page (default: 10)\n    - `sort` - Sort by `name`, `type`, `breed`, `age` (default: `CreatedAt`), use `-` before field name to sort in descending order (eg: `-name`)\n\nQuery Parameters:\n\n```\n    ?limit=20\u0026sort=name\n```\nResponse Body:\n\n```\n    {\n        \"status\": \"success\",\n        \"nbHits\": 2,\n        \"data\": [\n            {\n                \"_id\": \"6331c30c1915b32f0a3b1551\",\n                \"name\": \"Abagail\",\n                \"type\": \"Magpie, australian\",\n                \"breed\": \"Gymnorhina tibicen\",\n                \"age\": 758,\n                \"createdAt\": \"2022-09-26T15:19:36.139Z\"\n            },\n            {\n                \"_id\": \"6331c30c1915b32f0a3b12f7\",\n                \"name\": \"Abbe\",\n                \"type\": \"Sacred ibis\",\n                \"breed\": \"Threskionis aethiopicus\",\n                \"age\": 156,\n                \"createdAt\": \"2022-09-26T15:19:36.139Z\"\n            }\n        ]\n    }\n```\n\n**GET /api/v1/pet/:id**\n\n- Get a pet's data by id\n\nResponse Body:\n\n```\n    {\n        \"status\": \"success\",\n        \"data\": {\n            \"_id\": \"6331c30c1915b32f0a3b1551\",\n            \"name\": \"Abagail\",\n            \"type\": \"Magpie, australian\",\n            \"breed\": \"Gymnorhina tibicen\",\n            \"age\": 758,\n            \"createdAt\": \"2022-09-26T15:19:36.139Z\"\n        }\n    }\n```\n\n**PATCH /api/v1/pet/:id**\n\n- Update a pet's data by id (only name, type, breed, age can be updated)\n\nRequest Body:\n\n```\n    {\n        \"name\": \"Abagail\"\n    }\n\n```\n\nResponse Body:\n\n```\n{\n    \"status\": \"success\",\n    message: \"Data updated successfully\"\n    \"data\": {\n        \"_id\": \"6331c30c1915b32f0a3b12fa\",\n        \"name\": \"Abagail\",\n        \"type\": \"American racer\",\n        \"breed\": \"name\",\n        \"age\": 159,\n        \"createdAt\": \"2022-09-26T15:19:36.139Z\"\n    }\n}\n```\n\n**DELETE /api/v1/pet/:id**\n\n- Delete a pet's data by id\n\nResponse Body:\n\n```\n    {\n        \"status\": \"success\",\n        \"message\": \"Data deleted successfully\"\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit1kumar%2Fbug-free-potato","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohit1kumar%2Fbug-free-potato","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit1kumar%2Fbug-free-potato/lists"}