Skip to content

Latest commit

 

History

History
57 lines (34 loc) · 3.49 KB

README.md

File metadata and controls

57 lines (34 loc) · 3.49 KB

Build Status

Car Manager Service

How to build and run the app

  1. Run docker-compose build
  2. Run docker-compose up -d backend db

On another window run (make sure that both containers are up and running):

  1. Run docker-compose run backend rake db:setup

How to run application tests

Run docker-compose run test. (You only need to have db container up.)

Note: If you hit on some issue related with privileges try to run the above commands with sudo.

I've also setup Travis CI for this repository. You can check its badge on top of this page ✅. First time using docker on travis.yml 🚀🙌.

API Documentation

For API documentation, I've used Apipie which is a DSL and Rails engine for documenting RESTful APIs. You can see all the details here. First time using it and it was awesome! 👌🏽

If you run the API is just a matter of access the following endpoint: localhost:3000/apipie. There you will see the documentation for all the requested endpoints (POST, PUT/PATCH and GET). For each one you have details about:

  • Request method, path and description;
  • Request parameters (require or optional, type and description);
  • All possible errors that can be returned as a response (each with a proper description);
  • Request response body with all the details about parameters and types.

In case of you don't run the API please check the following GIF 😄.

Nov-16-2020 13-09-40

DB Schema

We have 5 tables: cars, models, makers, colors and model_colors (join table between models and colors). There's the schema for each table:

  1. Cars

Screenshot 2020-11-16 at 12 11 03

  1. Models

Screenshot 2020-11-16 at 12 07 50

  1. Makers

Screenshot 2020-11-16 at 12 09 39

  1. Colors

Screenshot 2020-11-16 at 12 10 01

  1. Model Colors

Screenshot 2020-11-16 at 12 10 27

You can also see the db schema here. I've used seeds.rb to populate all tables except cars table in order to have all resources prepared.

In addition, I've created db indexes for monthly, year and available_from columns (cars table), and name column (makers table). These indexes will make our reads much faster with API growth.