Skip to content

[Feature] Create Order#8

Merged
Katsshura merged 7 commits into
masterfrom
feature/create-order
Oct 12, 2022
Merged

[Feature] Create Order#8
Katsshura merged 7 commits into
masterfrom
feature/create-order

Conversation

@Katsshura

Copy link
Copy Markdown
Owner

Create Order Feature - Enabled API

Open API docs:

http://localhost:8080/swagger-ui.html
http://localhost:8080/v3/api-docs

CreateItemOrderDto Schema:

Fields marked with * are required and cannot be null.
Field Constraints
product_id* integer
quantity* integer

CreateOrderDto Schema:

Fields marked with * are required and cannot be null.
Field Constraints
products_quantities* Array of CreateItemOrderDto
user_id* integer
payment_id* integer
extra_charges* decimal

Request JSON Example: /order

{
  "products_quantities": [
    {
      "product_id": 1,
      "quantity": 10
    },
    {
      "product_id": 2,
      "quantity": 20
    }
  ],
  "user_id": 1,
  "payment_id": 2,
  "extra_charges": 4.99
}

Response JSON Example

{
    "order_id": 10,
    "order_items": [
        {
            "product": {
                "id": 1,
                "name": "Test Product One",
                "description": "Product Test Via Postman One",
                "price": 0.99,
                "image_url": "https://images.unsplash.com/photo-1551404973-7dec6ee9bba7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80",
                "available_stock": 5,
                "popularity": 0.0
            },
            "quantity": 10,
            "total": 9.90
        },
        {
            "product": {
                "id": 2,
                "name": "Test Product Two",
                "description": "Product Test Via Postman Two",
                "price": 2.99,
                "image_url": "https://images.unsplash.com/photo-1551404973-7dec6ee9bba7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80",
                "available_stock": 4,
                "popularity": 1.2
            },
            "quantity": 20,
            "total": 59.80
        }
    ],
    "order_total": 76.69,
    "delivery_tax": 6.99,
    "order_status": [
        {
            "status": "CREATED",
            "active": true
        }
    ]
}

@Katsshura
Katsshura merged commit 8e16cf4 into master Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant