Skip to content

This GitHub repository hosts the source code for an Order Management System API. The system is designed to manage orders, products, and customers within a business context.

Notifications You must be signed in to change notification settings

bitalizer/order-api

Repository files navigation

Order Management System API

This API provides robust functionality for managing orders, products, and customers in your business. It offers features such as creating customers and products, placing orders, and searching for orders by date.

Table of Contents

Technology Stack

This project is built with the following technology stack:

  • Spring Boot 3.1.4: A robust framework for building Java applications.
  • Hibernate: An object-relational mapping (ORM) library for efficient database interactions.
  • Liquibase: A database schema version control and migration tool.

Installation

  1. Clone this repository.
git clone https://github.com/bitalizer/order-api.git

Usage

This API allows you to manage orders, products, and customers.

Creating a Customer

To create a new customer, send a POST request to:

POST /api/v1/customers
{
    "full_name": "John Doe",
    "email": "johndoe@example.com",
    "phone_number": "123-456-7890",
    "registration_code": "ABC123"
}

Creating a Product

To create a new product, send a POST request to:

POST /api/v1/products
{
    "name": "Sample Product",
    "sku_code": "SKU123",
    "unit_price": "19.99"
}

Creating an Order

To place a new order, send a POST request to:

POST /api/v1/orders

Include the order details and order lines in the request body.

{
    "order_lines": [
        {
            "quantity": 5,
            "product_id": 1
        },
        {
            "quantity": 31,
            "product_id": 2
        }
    ],
    "customer_id": 1
}

Modifying Order Line Quantity

To change the quantity of products in an order line, send a PUT request to:

PUT /api/v1/orders/{order_id}/order-lines/{order_line_id}/quantity

Include the new quantity in the request body.

{
    "quantity": 60
}

Searching Orders

To search for orders, use the following endpoint with query parameters:

GET /api/v1/orders/search?product_id=1&customer_id=1&date_from=2023-01-01&date_to=2023-12-31

Modify the query parameters as needed to perform specific searches.

Configuration

Before running the application, configure these environment variables for the database connection:

  • DB_HOST: Hostname or IP address of the PostgreSQL server (default: localhost).
  • DB_PORT: Port number for the PostgreSQL server (default: 5432).
  • DB_NAME: Name of the target database
  • DB_USER: Database username
  • DB_PASSWORD: Database user's password

About

This GitHub repository hosts the source code for an Order Management System API. The system is designed to manage orders, products, and customers within a business context.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages