GithubHelp home page GithubHelp logo

order_management's Introduction

How to run this project with docker

Docker runs MySQL database and spring rest API with predefined data of goods!

Rest API:

  • port - 8080

MySql Database:

  • port: 3306

Clone project

git clone https://github.com/Snoke19/order_management.git

Go to the project folder and run docker-compose

cd ./order_management

docker compose up

Run tests with Maven and all tests working with test-containers with predefined database

cd ./order_management

./mvnw clear test

Endpoints

Manager

Add a new good:

curl -X POST --location "http://localhost:8080/api/v1/good" \
    -H "Content-Type: application/json" \
    -d "{
          \"description\": \"IPhone 11\",
          \"name\": \"IPhone 11 - best phone!\",
          \"price\": 40000,
          \"quantity\": 5
        }"

Get all available goods:

curl -X GET --location "http://localhost:8080/api/v1/goods" \
    -H "Content-Type: application/json"
[
  {
    "name": "iPhone 12",
    "description": "Flagship smartphone from Apple",
    "price": 1000,
    "quantity": 50,
    "id": 1
  }
]

Client

Create a new order and you can add many good for buying:

curl -X POST --location "http://localhost:8080/api/v1/order" \
    -H "Content-Type: application/json" \
    -d "{
          \"infoGoodOrders\": [{
            \"idGood\": 7,
            \"quantityBuy\": 2
          }]
        }"

Get all orders:

curl -X GET --location "http://localhost:8080/api/v1/orders" \
    -H "Content-Type: application/json"
[
  {
    "orderId": 1,
    "created": "2023-11-17T00:01:58",
    "status": "PAID",
    "orderGoodDetails": [
      {
        "goodId": 7,
        "name": "Samsung Galaxy Tab S7",
        "price": 600,
        "quantityBuy": 2
      }
    ]
  }
]

Pay for order

curl -X POST --location "http://localhost:8080/api/v1/order/pay" \
    -H "Content-Type: application/json" \
    -d "{
          \"orderId\": 1
        }"

order_management's People

Watchers

Oleksandr 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.