Code Monkey home page Code Monkey logo

factory's Introduction

Manufacturing company

Problem Overview

A Manufacturing company has various warehouses in multiple cities. When an order for a product is placed by their customers, the company wants to make sure the order is picked up from the warehouse that is closest to the customers location and containing the product.

Ask

Build a microservice with a REST API based interface to solve the above problem. There should be at least two key APIs one for adding of a new customer and the other to place of an order. The order placement API in the response should indicate from which warehouse the product would be delivered and the time/distance for arrival. The expectation is that the response time of order placement is fairly quick (< 500ms).

Assumptions

Assume that the distance/time between the customers city/location and warehouse is provided when customer is setup. The system would compute the using the data that is provided during setup. The format of the data can be anything as per the solution.

Assume a certain number of Warehouses & products to be present. Assume any structure for the data. Preferably represent that in JSON format as static data (or stored in db) that can be used for computation.

Technology requirements

  • Build the solution using Java
  • Preferably build the service using Sprint Boot
  • Usage of database is not necessary
  • Submit a brief write up of any key decisions being made
  • Bonus points for writing unit test cases (key scenarios)

General solution

To quickly place an order, you need to calculate in advance all the distances to the warehouses I will do this asynchronously (it can be message broker) when adding a new customer. Since at the time of ordering not all distances can be calculated we can directly calculate those that are missing

Running the server

./gradlew bootRun

API endpoints

GET /api/v1/products
POST /api/v1/customers
POST /api/v1/orders

factory's People

Contributors

eugeneborisevich avatar borev 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.