Skip to content
This repository has been archived by the owner on Feb 16, 2018. It is now read-only.

Latest commit

 

History

History
49 lines (40 loc) · 1.92 KB

README.md

File metadata and controls

49 lines (40 loc) · 1.92 KB
@dmarcoux/t

Pre-interview Task

Introduction

Rails 5 JSON API for users and their tasks. Each user has different needs regarding privacy, maintenance schedules and security. To respect this, each user has a database for his/her tasks. As for users, they are stored in a single database.

Setup

  1. Install Docker and Docker-Compose (Tested on Linux with versions 17.10.0-ce and 1.17.0 respectively)
  2. Copy the environment file with cp .env.example .env
  3. Copy the secrets file with cp config/secrets.yml.example config/secrets.yml

Application

  1. Start the application with docker-compose up development (If you get the error PG::ConnectionBad: could not connect to server: Connection refused, run it again as sometimes the database isn't ready in time for the application)
  2. Access it at localhost:3000 (The port is the value of $RAILS_PORT from the file .env)
    1. Create a user:
    curl --verbose --header "Content-Type: application/json" --data '{ "user": {"email":"[email protected]","password":"'12345'"} }' localhost:3000/users
    1. Login with the user:
    curl --verbose --header "Content-Type: application/json" --data '{ "auth": {"email":"[email protected]","password":"'12345'"} }' localhost:3000/user_token
    1. Create a task for the user:
    curl --verbose --header "Authorization: Bearer TOKEN_FROM_LOGIN_REQUEST" --header "Content-Type: application/json" --data '{ "task": { "start":"2017-11-16T16:28:54+01:00", "end":"2017-11-16T17:28:54+01:00", "description":"Something" } }' localhost:3000/tasks
    1. List tasks of the user:
    curl --verbose --header "Authorization: Bearer TOKEN_FROM_LOGIN_REQUEST" localhost:3000/tasks

Development

  1. Start the development environment with docker-compose run --service-ports development bash
    1. Run specs/tests with: TODO
    2. Run code style checks with: rubocop