Coder Social home page Coder Social logo

car-manager's Introduction

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.

car-manager's People

Contributors

bernardomg avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.