GithubHelp home page GithubHelp logo

mgerasimchuk / space-trouble Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 2.83 MB

HTTP API business application following Clean Architecture principles

Go 95.94% Makefile 4.06%
api clean-architecture golang business-application

space-trouble's Introduction

Lint Golangci Lint Architecture Test (unit) Coverage (unit) Test (integration)

Space Trouble

Solution for the Space trouble challenge

Requirements

How to use

Run this command:

make start

After:

API doc: http://localhost:8085

Send request over curl:

curl --location --request POST 'localhost:8080/v1/bookings' \
--header 'Content-Type: application/json' \
--data-raw '{
  "firstName": "John",
  "lastName": "Doe",
  "gender": "male",
  "birthday": "2021-01-31",
  "launchpadId": "5e9e4501f509094ba4566f84",
  "destinationId": "5e9e3032383ecb761634e7cb",
  "launchDate": "2031-09-25"
}'
curl --location --request GET 'localhost:8080/v1/bookings'
curl --location --request DELETE 'localhost:8080/v1/bookings/10227205-3628-4c94-a070-f5731c38b3e6'

See data in DB:

docker-compose -f deployments/docker-compose/docker-compose.yaml run migrations-up bash -c 'psql -c "SELECT * FROM bookings"'

Configuration

See env file: deployments/docker-compose/.env

Details of realisation

As an architectural approach was used

The project layout follows

Space trouble challenge

Imagine it’s 2049 and you are working for a company called SpaceTrouble that sends people to different places in our solar system. You are not the only one working in this industry. Your biggest competitor is a less known company called SpaceX. Unfortunately you both share the same launchpads and you cannot launch your rockets from the same place on the same day. There is a list of available launchpads and your spaceships go to places like: Mars, Moon, Pluto, Asteroid Belt, Europa, Titan, Ganymede. Every day you change the destination for all the launchpads. Basically on every day of the week from the same launchpad has to be a “flight” to a different place.

Information about available launchpads and upcoming SpaceX launches you can find by SpaceX API: https://api.spacexdata.com/

Your task is to create an API that will let your consumers book tickets online.

In order to do that you have to create 2 endpoints:

  1. Endpoint to book a ticket where client sends data like:

    • First Name
    • Last Name
    • Gender
    • Birthday
    • Launchpad ID
    • Destination ID
    • Launch Date

    You have to verify if the requested trip is possible on the day from provided launchpad ID and do not overlap with SpaceX launches, if that’s the case then your flight is cancelled.

  2. Endpoint to get all created Bookings.

Extra points:

  • When you use docker/docker-compose to run the project.

  • When you write unit/functional tests.

  • When you create an endpoint to delete booking.

Technical requirements:

  • Please, use Golang and Postgres.

  • Please, use github or bitbucket.

  • Commit your changes often. Do not push the whole project in one commit.

space-trouble's People

Contributors

mgerasimchuk avatar

Stargazers

 avatar

Watchers

 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.