Giter Site home page Giter Site logo

bakery's Introduction

Bakery

Order product packs getting always the minimal quantity of packs.

Architecture

  • Java
  • Spring Boot
  • Maven
  • Tomcat
  • JUnit
  • Mockito
  • H2 database
  • Lombok

Run tests

  • mvn test

Build

  • mvn clean package

Endpoints

Web port: 8090

Expose two endpoints.

  • Endpoint with text body:

POST /order/order HTTP/1.1
Host: localhost:8090
10 VS5
14 MB11
13 CF

Response:
10 VS5 $8,99
       2 x $8,99
14 MB11 $34,90
       1 x $24,95
       3 x $9,95
13 CF $15,90
       2 x $9,95
       1 x $5,95

  • Endpoint with JSON objects of request and response:

POST /order/order-json HTTP/1.1
Host: localhost:8090
Content-Type: application/json
[
  {
    "productQuantity": "10",
    "productCode": "VS5"
  },
  {
    "productQuantity": "14",
    "productCode": "MB11"
  },
  {
    "productQuantity": "13",
    "productCode": CF"
  }
]

Response:
[
  {
    "productQuantity": 10,
    "productCode": "VS5",
    "productTotalCost": 8.99,
    "packs": [
      {
        "packQuantity": 2,
        "productQuantity": 5,
        "packCost": 8.99
      }
    ]
  },
  {
    "productQuantity": 14,
    "productCode": "MB11",
    "productTotalCost": 34.9,
    "packs": [
      {
        "packQuantity": 1,
        "productQuantity": 8,
        "packCost": 24.95
      },
      {
        "packQuantity": 3,
        "productQuantity": 2,
        "packCost": 9.95
      }
    ]
  },
  {
    "productQuantity": 13,
    "productCode": "CF",
    "productTotalCost": 15.899999999999999,
    "packs": [
      {
        "packQuantity": 2,
        "productQuantity": 5,
        "packCost": 9.95
      },
      {
        "packQuantity": 1,
        "productQuantity": 3,
        "packCost": 5.95
      }
    ]
  }
]

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.