---
# System prepended metadata

title: Coding Challenge (by Diego Penha)

---

# Coding Challenge (by Diego Penha)
## Problem Description
It's 2053, humanity has finally conquered Mars and became interplanetary. Even tho we have self landing rockets, the only thing society still lacks, is a great app to book flights to Mars.  
It doesn't have to be complicated, users just want to be able to select a rocket company on a list and book their date to flight.

## Requirements
You will develop an app that consumes a REST API which will store information about the rocket companies, their prices, rocket types as well as a booking system.

In order to accomplish this, the system must fulfill the following use cases, sorted by importance to guarantee the satisfaction of the users.

### Registration/Login system
We obviously need to have users on our system. They need to have 2 roles: "admin", "regular".
The admin user will have special capabilities on the app, while the regular user will basically be the consumer.
Users must have:
- id
- name
- registered flight booking (they can only book one flight)
- balance (how much the user has available. This can be a default value, like U$500.00 and must be update when a flight is booked)

You can choose any method you want for this step, in order to implement an "user system". You can even just add users by hand on the database instead of a registration process. Do what you feel more comfortable.

### Add rocket companies to the database (CRUD):
An "admin" user should be able to use the app to add companies to the database. A rocket company must have:
- id
- name
- rating (rating from users)
- **rockets**

"Rockets" are which rockets the company has. They must have the following properties:
- id
- model (can be a simple string)
- price per flight
- dates available (a list of dates that this rocket will be launched, no need to consider the return of the rocket)
- sits available (just a number, this is updated when a user books a flight on this rocket)
- available for booking (when there are no sits, this rocket should no longer be available for booking)

The interface is expected to have menus to add/edit/get a company and rockets (that must be linked to a company). Those menus should only show for "admin" users of the app.

### Search for companies:
Once the database has companies and rockets inserted into it, a regular user should be able to browse a company and pick a flight.

The optimal scenario would be an interface that allows the user to filter the companies (by dates, prices), but a simple list with all available companies is also acceptable.

### Book a flight:
When the user chooses a company of interest, it can select the rocket and the date it wants to flight.  
Remember to make sure there are no booking overlaps, we don't want people to get confused! Here are some simple rules you might want to consider:
- the flights are one way only, you don't need to consider the return.
- one book per user: user can't book two flights, once he goes to mars, there's no comming back for another 50 years. But the user can cancel a booking.

### Rate a company
After users flight, they must be able to rate the company. A user can only rate the company if they booked a flight and then the date of the flight has passed (this can mean he is already flying, or landed).

## Notes:
- The app must be made using React Native, Flutter or Ionic (you can use other techs, but we don't recommend it, since our goal is to use one of the three listed in our project)
- You can use any technology you want for the back-end (asp .net core, node, even the recently released version of deno)
- You can use any database you want (firebase, sql, postgres, even sqlite)
- You must document your API
- You must provide an .apk build and an API deploy (you can use heroku to deploy it for free)
- You **DON'T** need to implement everything described here. Do what feel comfortable to do, if you think it's easier to do it without filtering, or aplicatin rules, you can, but the final product will be revised taking these recommendations in account.
- You can also **DO** more than it's described here, adding maps, proximity of rocket launch, filter by rocket speed, etc. Be as creative as you want.
- The app must be developed on a GitHub repo (if you make it private, please send the collaborator invite to diego.penha95@gmail.com)
- You must deliver the final product on the time you proposed to do it.

Above all: have fun.