This application is proposed as a challenge by AIESEC & RD Station Team.
Code made without plugins to maximize code evaluation.
Source code can be found in this github repo.
Implementation can be found in this heroku site.
The applications maintains the register of both models proprosed, Contacts and Cities, it covers all CRUD operations.
A SQL architecture was chosen // due to the many filters proposed.
Ruby on Rails was chosen as the framework // due to tight deadline.
Is available in 3 languages [ Portuguese | English | Spanish ] // you can change it at the bottom left of the page
It can query contacts by any field
- age: use either [ equals | older | younger ]
- gender: use either [ none | male | female ]
- state: use either [ none | open | accepted | rejected ] 🐸 I wish you'll set me to accepted state with this application
- city: use any created
- all other string attributes: use contains // most useful and cover all the others
-
Contact:
- id: integer // autogenerated
- city_id: integer // belongs to, one to many relationship
- name: string
- email: string
- age: integer
- state: integer // could be either [ open | accepted | rejected ]
- job: string
- gender: boolean // isMale 🐸 good for data performance, wait, what? sexism? other genders?
- dni: string
- phone: string
- created_at: datetime
- updated_at: datetime
-
City:
- id: integer
- name: string
- country: string 🐸 I love Floripa <3
- created_at: datetime
- updated_at: datetime
Each model has an associated controller
e.g. HTTP methods for Contact Model:
GET /contacts # List of filterable contacts
def index
GET /contacts/id # Returns contact with given id
def show
GET /contacts/new # Returns form to create a new contact
def new
GET /contacts/id/edit # Returns form to edit contact with given id
def edit
POST /contacts # Method to create the contact
def create
PATCH|PUT /contacts/id # Method to edit the contact
def update
DELETE /contacts/id # Method to delete the contact
def destroy
Views are made of html files with embedded ruby // .html.erb // with some javascript help to build the queries
- Ruby SDK downloaded and installed on your machine. Refer to this page for details.
- PostgreSQL downloaded, installed on your machine up and running. Refer to this page for details.
As a rule of thumb you would have to create and initialize your DB first, we will also populate it with mock data, this is easy by rake commands:
$ cd project
$ rake db:drop db:create db:migrate db:seed
To run the app you finally have to execute
$ rails server
This by default will launch a web server named Puma on port 3000
Due to tight deadline further improvements are required
- Validate data on forms
- Improve automated testings
- Paginate Contacts
- Notice not showing when deleting records
- Calculate age based on a birthdate
- Remove country calling code from phone and keep as integer