Coder Social home page Coder Social logo

iagl-nodejs-coding-task's Introduction

IAGL Recruitment - NodeJS Assessment

Context

Imagine a customer has a certain number of Avios points which they would like to redeem on an upcoming trip. They have decided to fly with British Airways and have navigated to their website (www.britishairways.com) in order to book a flight. Upon landing on the payment page, they should be presented with four price options (called price points) to choose from in order to use their Avios to discount the total price of the flight, or they can choose not to use any Avios.

These price points should be set percentages worth 20%, 50%, 70% or 100% of the price of the flight (the cash discount). The amount of Avios required for each price point will be calculated using a static value per Avios based on the flight route from the table below. There will be five key routes where a different rate is used, otherwise the default value of 0.02 should be used for all other routes.

Departure Airport Code Arrival Airport Code Value per Avios
LHR LAX 0.028
LHR AMS 0.025
LHR JFK 0.03
LGW LAX 0.027
LGW MUC 0.024
- - 0.02

The Task

A REST web service needs to be created containing the logic to calculate the price points. Your API will be called by the website, and the response of the API (containing the price points) will be rendered by the website for the customer to choose from.

API Contract

The API should expose one endpoint which will accept the following request data in order to do the calculation:

  • DepartureAirportCode
  • ArrivalAirportCode
  • DepartureTime
  • ArrivalTime
  • Price
  • Currency

The API should respond with the four price points, containing the calculated cash discount and the Avios amount for that price point.

Technology

Please use any NodeJS framework and ReactJS. You may use any libraries and dependencies you wish to complete the task. Tips:

  • Think about good, clean design and simulate, within reason, a production ready app.

Deliverables

  • Mandatory - A production ready API that calculates the cash discount and the price point
  • Optional #1 - A ReactJS application that emulates the creation of a small calculator for the API endpoint created in the step before.
  • Optional #2 - A Docker Compose file designed to facilitate the execution of the API in conjunction with a PostgreSQL database within a local development environment. Ensure there is a table in your postgre database to read the table values described in the Context section.

To complete this assessment, you need to deliver the mandatory option and at least one of the Optional ones Your finished code should be uploaded to your personal Github account and a link to this sent to the contact person.

Running

To spin up HTTP and API servers run

npm run dev

iagl-nodejs-coding-task's People

Contributors

romasato avatar

Watchers

 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.