{"id":24665887,"url":"https://github.com/rafaelmoraes003/car-shop","last_synced_at":"2026-04-09T17:04:52.554Z","repository":{"id":132548103,"uuid":"556064341","full_name":"rafaelmoraes003/car-shop","owner":"rafaelmoraes003","description":"CRUD API for a vehicle dealership with a MongoDB database.","archived":false,"fork":false,"pushed_at":"2023-02-14T02:51:17.000Z","size":240,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T10:52:46.820Z","etag":null,"topics":["chai","docker","express","http-server","mocha","mongodb","mongoose","nodejs","oop","sinon","solid-principles","typescript","unit-testing","zod"],"latest_commit_sha":null,"homepage":"","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/rafaelmoraes003.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}},"created_at":"2022-10-23T01:13:21.000Z","updated_at":"2023-01-16T08:14:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"0168eb9a-9842-40bb-9454-bda4059b6865","html_url":"https://github.com/rafaelmoraes003/car-shop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rafaelmoraes003/car-shop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fcar-shop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fcar-shop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fcar-shop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fcar-shop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafaelmoraes003","download_url":"https://codeload.github.com/rafaelmoraes003/car-shop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fcar-shop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265611264,"owners_count":23797848,"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":["chai","docker","express","http-server","mocha","mongodb","mongoose","nodejs","oop","sinon","solid-principles","typescript","unit-testing","zod"],"created_at":"2025-01-26T07:13:58.511Z","updated_at":"2025-12-30T19:54:49.780Z","avatar_url":"https://github.com/rafaelmoraes003.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"left\"\u003eCar Shop\u003c/h1\u003e\n\n###\n\n\u003cp align=\"left\"\u003eIn this project, a CRUD API was created for a car dealership with a MongoDB database.\u003cbr\u003e\u003cbr\u003eFor the development of the API, ODM Mongoose was used to connect the database with Node.js . \u003cbr\u003e\u003cbr\u003eThe project uses the MSC (Model-Service-Controller) architecture, Object Orientation following the SOLID principles with TypeScript and unit tests made with Mocha, Chai and Sinon, which cover 100% of the lines of code from the project.\u003c/p\u003e \n\n###\n\n\u003ch2 align=\"left\"\u003eTechnologies used\u003c/h2\u003e\n\n###\n\n\u003cdiv align=\"left\"\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/nodejs/nodejs-original.svg\" height=\"50\" width=\"62\" alt=\"nodejs logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/typescript/typescript-original.svg\" height=\"50\" width=\"62\" alt=\"typescript logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/express/express-original.svg\" height=\"50\" width=\"62\" alt=\"express logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/mongodb/mongodb-original.svg\" height=\"50\" width=\"62\" alt=\"mongodb logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/mocha/mocha-plain.svg\" height=\"50\" width=\"62\" alt=\"mocha logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/docker/docker-original-wordmark.svg\" height=\"50\" width=\"62\" alt=\"docker logo\"  /\u003e\n\u003c/div\u003e\n\n###\n\n\u003ch2 align=\"left\"\u003eHow to use the application\u003c/h2\u003e\n\nClone the application using the `git clone` command. After that, enter the project folder using the `cd car-shop` command.\n\n###\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003cstrong\u003e🐳 Running through Docker\u003c/strong\u003e\n  \u003c/summary\u003e\u003cbr\u003e\n\n  - Inside the project folder, use the `docker-compose up -d` command. It is responsible for uploading the Node.js API and the MongoDB database.\n  - Enter the container's terminal via the `docker exec -it car_shop bash` command.\n  - Inside the container, install the necessary dependencies using the `npm install` command.\n  - Finally, still inside the container's terminal, to initialize the API, use the `npm run dev` command.\n  \u003e The API is on port `3001` on localhost.\n\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003cstrong\u003eRunning locally\u003c/strong\u003e\n  \u003c/summary\u003e\u003cbr\u003e\n\n  - Inside the project folder, use the `npm install` command to install the necessary dependencies.\n  - Put the MongoDB URI in the `./src/models/connection.ts` file in the `MONGO_DB_URL` variable.\n  - Use the `npm run dev` command to initialize the API.\n  \u003e The API is on port `3001` on localhost.\n\n\n\u003c/details\u003e\n\n###\n\n\u003ch2 align=\"left\"\u003eUnit tests and test coverage\u003c/h2\u003e\n\n- To run the unit tests, use the `npm run test:dev` command.\n- To verify test coverage, use the `npm run test:coverage` command.\n\n###\n\n\u003ch2 align=\"left\"\u003eEndpoints\u003c/h2\u003e\n\n\u003ch3 align=\"left\"\u003eCars\u003c/h3\u003e\n\n| Method | Functionality | URL |\n|---|---|---|\n| `POST` | Create new car  | http://localhost:3001/cars |\n| `GET` |  List all cars  | http://localhost:3001/cars |\n| `GET` |  List a car based on its _id  | http://localhost:3001/cars/:id |\n| `PUT` |  Update a car based on its _id  | http://localhost:3001/cars/:id |\n| `DELETE` | Delete a car based on its _id  | http://localhost:3001/cars/:id |\n\n#### The `POST` and `PUT` endpoints require a JSON object in the following format:\n\n```JavaScript\n{\n  model: \"Ferrari Maranello\", \n  year: 1963, \n  color: \"red\",\n  buyValue: 3500000,\n  status: true,\n  seatsQty: 2,\n  doorsQty: 2\n}\n```\n\n- About the properties of the above object, it is important to know:\n\n```JavaScript\n{\n  model: String with at least 3 characters\n  year: Number greater than or equal to 1900 and less than or equal to 2022\n  color: String with at least 3 characters\n  buyValue: Integer\n  status: Optional property, indicates whether or not the car can be purchased (boolean)\n  seatsQty: Number greater than or equal to 2 and less than or equal to 7\n  doorsQty: Number greater than or equal to 2 and less than or equal to 4\n}\n```\n\n###\n\n\u003ch3 align=\"left\"\u003eMotorcycles\u003c/h3\u003e\n\n| Method | Funcionality | URL |\n|---|---|---|\n| `POST` | Create new motorcycle | http://localhost:3001/motorcycles\n| `GET` |  List all motorcycles  | http://localhost:3001/motorcycles |\n| `GET` |  List a motorcycle based on its _id  | http://localhost:3001/motorcycles/:id |\n| `PUT` |  Update a motorcycle based on its _id  | http://localhost:3001/motorcycles/:id |\n| `DELETE` |  Delete a motorcycle based on its _id  | http://localhost:3001/motorcycles/:id |\n\n#### The `POST` and `PUT` endpoints require a JSON object in the following format:\n\n```JavaScript\n{\n  model: \"Honda Biz\",\n  year: 2022,\n  color: \"red\",\n  buyValue: 3500,\n  status: false,\n  category: \"Street\",\n  engineCapacity: 125\n}\n```\n\n- About the properties of the above object, it is important to know:\n\n```JavaScript\n{\n  model: String with at least 3 characters\n  year: Number greater than or equal to 1900 and less than or equal to 2022\n  color: String with at least 3 characters\n  buyValue: Integer\n  status: Optional property, indicates whether or not the motorcycle can be purchased (boolean)\n  category: String that only accepts the values Street, Custom or Trail\n  engineCapacity: Number greater than 0 and less than or equal to 2500\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelmoraes003%2Fcar-shop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafaelmoraes003%2Fcar-shop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelmoraes003%2Fcar-shop/lists"}