0xJ1NX / inventory-management-system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inventory-management-system

Inventory Management System logo

This is a simple inventory management system REST API, that allow managing Items, Customers, Orders, Suppliers, and supplies, and provide consistent and easy to use API.

Note

Maybe there is some missing information or bugs in the code or the documentation, i will update it as soon as possible, if you find any issue please open an issue or contact me.


πŸ“ Table of Contents

🧰 Resources

the following are the resources in the inventory management system API

  • Items : the products in the inventory

  • Suppliers : the people who supply the items to the inventory

  • Customers : are the people who buy the items

  • Orders : the transactions of the items between the customers and the inventory

  • Supplies : the transaction of the items between the suppliers and the inventory

✏ ERD's and Diagrams

  • The following diagram shows the Entity Relationship Diagram. ERD

  • The following diagram shows the database Design. Database Design

πŸ“‹ API Endpoints and Documentation

  • The following are the API endpoints and their documentation

Base URL : example.com/api/v1

/items

HTTP Request Operation Description HTTP Status Code Request Body Sample Response Body Sample

GET /items

Read Get all items 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Items fetched successfully",
  "data": [
    {
      "id": 4,
      "name": "kjdslkjfklds",
      "description": "1234",
      "price": 22.0,
      "quantity": 20
    }
  ]
}

GET /items/{id}

Read Get item by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Item fetched successfully",
  "data": {
    "id": 4,
    "name": "kjdslkjfklds",
    "description": "1234",
    "price": 22.0,
    "quantity": 20
  }
}

POST /items

Create Create new item the quantity initiale zero 201 (Created)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "name": "item1",
    "description": "item1 description",
    "price": 100
}
{
  "status": "success",
  "httpStatus": 201,
  "message": "Item created successfully",
  "data": {
    "id": 5,
    "name": "mfmo",
    "description": "1234",
    "price": 22.0,
    "quantity": 0
  }
}

PUT /items/{id}

Update Update item by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "name": "item1",
    "description": "item1 description",
    "price": 100
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Item updated successfully",
  "data": {
    "id": 4,
    "name": "m",
    "description": "14",
    "price": 22.0,
    "quantity": 20
  }
}

DELETE /items/{id}

Delete Delete item by id 204 (No Content)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
410 (Gone)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Item deleted successfully",
  "data": {
    "id": 6,
    "name": "mfo",
    "description": "1234",
    "price": 22.0,
    "quantity": 0
  }
}

PATCH /items/{id}

Partial Update Partial Update item by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "name": "item1"
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Item Updated successfully",
  "data": {
    "id": 6,
    "name": "mfo",
    "description": "1234",
    "price": 22.0,
    "quantity": 0
  }
}

/suppliers

HTTP Request Operation Description HTTP Status Code Request Body Sample Response Body Sample

GET /suppliers

Read Get all suppliers 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Suppliers fetched successfully",
  "data": [
    {
      "id": 2,
      "name": "sdfgh",
      "address": "ramallah",
      "email": "dsfdsfdsf",
      "phone": "0568347131"
    }
  ]
}

GET /suppliers/{id}

Read Get supplier by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Suppliers fetched successfully",
  "data": {
      "id": 2,
      "name": "sdfgh",
      "address": "ramallah",
      "email": "dsfdsfdsf",
      "phone": "0568347131"
    }
}

POST /suppliers

Create Create new supplier 201 (Created)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "name":"omar",
  "address":"ramallah",
  "phone":"0568347131",
  "email":"dsfdsfdsf"
}
{
  "status": "success",
  "httpStatus": 201,
  "message": "Supplier created successfully",
  "data": {
    "id": 3,
    "name": "omar",
    "address": "ramallah",
    "email": "dsffdsf",
    "phone": "8347131"
  }
}

PUT /suppliers/{id}

Update Update supplier by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "name":"omar",
  "address":"ramallah",
  "phone":"8347131",
  "email":"dsffdsf"
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supplier updated successfully",
  "data": {
    "id": 3,
    "name": "omar",
    "address": "rallah",
    "email": "dsfdsfdsf",
    "phone": "0568347131"
  }
}

DELETE /suppliers/{id}

Delete Delete supplier by id 204 (No Content)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
410 (Gone)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supplier deleted successfully",
  "data": {
    "id": 3,
    "name": "omar",
    "address": "rallah",
    "email": "dsfdsfdsf",
    "phone": "0568347131"
  }
}

PATCH /suppliers/{id}

Partial Update Partial Update supplier by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "name": "supplier1"
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supplier updated successfully",
  "data": {
    "id": 3,
    "name": "omar",
    "address": "rallah",
    "email": "dsfdsfdsf",
    "phone": "0568347131"
  }
}

/customers

HTTP Request Operation Description HTTP Status Code Request Body Sample Response Body Sample

GET /customers

Read Get all customers 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Customers fetched successfully",
  "data": [
    {
      "id": 12,
      "name": "omsdjlsjdlkdsjlkar",
      "email": "dsfdsfdsf",
      "phone": "0568347131",
      "address": "ramallah"
    }
  ]
}

GET /customers/{id}

Read Get customer by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Customer fetched successfully",
  "data": {
    "id": 12,
    "name": "omsdjlsjdlkdsjlkar",
    "email": "dsfdsfdsf",
    "phone": "0568347131",
    "address": "ramallah"
  }
}

POST /customers

Create Create new customer 201 (Created)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "name":"omar",
  "address":"ramallah",
  "phone":"056131",
  "email":"dsffdsf"
}
{
  "status": "success",
  "httpStatus": 201,
  "message": "Customer created successfully",
  "data": {
    "id": 14,
    "name": "omar",
    "email": "dsffdsf",
    "phone": "056131",
    "address": "ramallah"
  }
}

PUT /customers/{id}

Update Update customer by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "name":"omar",
  "address":"ramallah",
  "phone":"056131",
  "email":"dsffdsf"
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Customer updated successfully",
  "data": {
    "id": 12,
    "name": "omjlkjlklkar",
    "email": "dsfdsfdsf",
    "phone": "0568347131",
    "address": "ramallah"
  }
}

DELETE /customers/{id}

Delete Delete customer by id 204 (No Content)
400 (Bad Request)
401 (Unauthorized)
(Forbidden)
(Not Found)
(Too Many Requests)
410 (Gone)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Customer deleted successfully",
  "data": {
    "id": 14,
    "name": "omar",
    "email": "dsffdsf",
    "phone": "056131",
    "address": "ramallah"
  }
}

PATCH /customers/{id}

Partial Update Partial Update customer by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "name": "customer1"
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Customer updated successfully",
  "data": {
    "id": 12,
    "name": "omjlkjlklkar",
    "email": "dsfdsfdsf",
    "phone": "0568347131",
    "address": "ramallah"
  }
}

/orders

HTTP Request Operation Description HTTP Status Code Request Body Sample Response Body Sample

GET /orders

Read Get all orders 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Orders fetched successfully",
  "data": [
    {
      "id": 8,
      "date": "2024-04-17T20:02:43.376+00:00",
      "customerId": 12,
      "orderItemsDTOS": [
        {
          "id": 12,
          "quantity": 2,
          "itemId": 4
        }
      ]
    }
  ]
}

GET /orders/{id}

Read Get order by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Order fetched successfully",
  "data": {
    "id": 8,
    "date": "2024-04-17T20:02:43.376+00:00",
    "customerId": 12,
    "orderItemsDTOS": [
      {
        "id": 12,
        "quantity": 2,
        "itemId": 4
      }
    ]
  }
}

POST /orders

Create Create new order 201 (Created)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "customerId": 12,
  "orderItems": [
    {
      "itemId": 4,
      "quantity": 2
    }
  ]

}
{
  "status": "success",
  "httpStatus": 201,
  "message": "Order created successfully",
  "data": {
    "id": 9,
    "date": "2024-04-17T20:33:45.529+00:00",
    "customerId": 12,
    "orderItemsDTOS": [
      {
        "id": 13,
        "quantity": 2,
        "itemId": 4
      }
    ]
  }
}

PUT /orders/{id}

Update Update order by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "customerId": 12,
  "orderItems": [
    {
      "itemId": 4,
      "quantity": 2
    }
  ]

}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Order updated successfully",
  "data": {
    "id": 8,
    "date": "2024-04-17T20:02:43.376+00:00",
    "customerId": 12,
    "orderItemsDTOS": [
      {
        "id": 14,
        "quantity": 11,
        "itemId": 4
      }
    ]
  }
}

DELETE /orders/{id}

Delete Delete order by id 204 (No Content)
400 (Bad Request)
401 (Unauthorized)
(Forbidden)
(Not Found)
(Too Many Requests)
410 (Gone)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Order deleted successfully",
  "data": null
}

PATCH /orders/{id}

Partial Update Partial Update order by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "quantity": 10
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Order updated successfully",
  "data": {
    "id": 8,
    "date": "2024-04-17T20:02:43.376+00:00",
    "customerId": 12,
    "orderItemsDTOS": [
      {
        "id": 14,
        "quantity": 11,
        "itemId": 4
      }
    ]
  }
}

/supplies

HTTP Request Operation Description HTTP Status Code Request Body Sample Response Body Sample

GET /supplies

Read Get all supplies 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supplies fetched successfully",
  "data": [
    {
      "id": 2,
      "itemId": 4,
      "supplierId": 2,
      "quantity": 22,
      "ppu": 220.0,
      "date": "2024-04-17T20:06:09.834+00:00"
    }
  ]
}

GET /supplies/{id}

Read Get supply by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supply fetched successfully",
  "data": {
    "id": 2,
    "itemId": 4,
    "supplierId": 2,
    "quantity": 22,
    "ppu": 220.0,
    "date": "2024-04-17T20:06:09.834+00:00"
  }
}

POST /supplies

Create Create new supply 201 (Created)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "itemId": 4,
  "quantity": 3,
  "supplierId":2,
  "ppu":220
}
{
  "status": "success",
  "httpStatus": 201,
  "message": "Supply created successfully",
  "data": {
    "id": 3,
    "itemId": 4,
    "supplierId": 2,
    "quantity": 3,
    "ppu": 220.0,
    "date": "2024-04-17T20:36:57.956+00:00"
  }
}

PUT /supplies/{id}

Update Update supply by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found)
429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
  "itemId": 4,
  "quantity": 100,
  "supplierId":2,
  "ppu":220
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supply updated successfully",
  "data": {
    "id": 2,
    "itemId": 4,
    "supplierId": 2,
    "quantity": 100,
    "ppu": 220.0,
    "date": "2024-04-17T20:06:09.834+00:00"
  }
}

DELETE /supplies/{id}

Delete Delete supply by id 204 (No Content)
400 (Bad Request)
401 (Unauthorized)
(Forbidden)
(Not Found)
(Too Many Requests)
410 (Gone)
500(Internal Server Error)
N/A
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supply deleted successfully",
  "data": null
}

PATCH /supplies/{id}

Partial Update Partial Update supply by id 200 (OK)
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
404 (Not Found), 429(Too Many Requests)
415 (Unsupported Media Type)
500(Internal Server Error)
{
    "quantity": 10
}
{
  "status": "success",
  "httpStatus": 200,
  "message": "Supply updated successfully",
  "data": {
    "id": 2,
    "itemId": 4,
    "supplierId": 2,
    "quantity": 10,
    "ppu": 220.0,
    "date": "2024-04-17T20:06:09.834+00:00"
  }
}

OpenAPI Documentation

OpenAPI v3.1.0

  • The OpenAPI v3.1.0 is available in the following link SwaggerHub

Postman Collection

Postman

πŸ“¦ Running the project

  • Clone the repository
    git clone https://github.com/0xJ1NX/inventory-management-system.git
  • Change the directory to the project directory
    cd inventory-management-system
  • Run the project
    gradle bootRun
  • The project will run on the default port 8080

About


Languages

Language:Java 100.0%