rukins / Antevorta-backend

Inventory Management System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inventory Management System (Training project). Backend side

General info

Inventory management system for e-commerce. The API allows you to manage data from different online stores like Amazon, Walmart, Etsy, Shopify, Ebay etc. and stores it in one place.

Initially the user creates an account, then they connect their e-commerce stores, and then when the stores are connected the data populates the app, showing the inventory items(products)' data (title, price, quantity, etc.). Through the API you can read, create, update and delete inventory items(products). All data is pulled from online store's API.

For now the following stores are available:

  • Shopify
  • Ebay

What improvements can be made:

  • More e-commerce stores (Amazon, Walmart, Etsy, etc.)
  • Update the method of user authorization, maybe integrate OAuth2. Now it doesn't provide very good protection
  • Use hashing instead of encryption for user passwords
  • Inventory item reports
  • Webhooks for inventory items
  • More data to manage in the app (for example, orders)

Auth

Login

POST /auth/login
  • Body:
{
  "email": "email@email.com",
  "password": "password"
}
  • Returns:
{
  "status": 200,
  "message": "Logged in successfully"
}

Logout

POST /auth/logout
  • Returns:
{
  "status": 200,
  "message": "Logged out successfully"
}

Signing up

POST /signup
  • Body:
{
  "firstname": "firstname",
  "lastname": "lastname",
  "email": "email@email.com",
  "password": "password"
}
  • Returns:
{
  "status": 201,
  "message": "Signed up successfully"
}

User

getUserinfo

GET /user
  • Returns:
{
  "user": {
    "id": 1,
    "email": "email@email.com",
    "firstname": "firstname",
    "lastname": "lastname",
    "verified": false,
    "authorities": [
      {
        "name": "someAuthority"
      }
    ]
  }
}

updateUser

PUT /user?field=
  • Parameter field can be equal to firstname, lastname, firstname, lastname, email or password (if it is equal to the last two, the session will be logged out)
  • Body depends on what you want to update
  • Returns:
{
  "user": {
    "id": 1,
    "email": "new@email.com",
    "firstname": "new",
    "lastname": "new",
    "verified": false,
    "authorities": []
  }
}

verify

POST /user/verification/verify
  • Returns:
{
  "status": 200,
  "message": "User email has been successfully verified"
}

sendVerificationCode

POST /user/verification/mail
  • Returns:
{
  "status": 200,
  "message": "Verification code has been successfully sent"
}

Online stores

getAll

GET /onlinestores
  • Returns:
{
  "onlineStores": [
    {
      "id": {
        "ordinal": 1,
        "email": "email@email.com"
      },
      "arbitraryStoreName": "storeName",
      "type": "SHOPIFY"
    },
    {
      "id": {
        "ordinal": 2,
        "email": "email@email.com"
      },
      "arbitraryStoreName": "anotherStoreName",
      "type": "AMAZON"
    }
  ]
}

addToUser

POST /onlinestores
  • Body:
{
  "type": "SHOPIFY",
  "arbitraryStoreName": "storeName",
  "credentials": {
    "storeName": "someStoreName",
    "token": "",
    "extra": {
      "username": "username",
      "password": "password"
    }
  }
}

credentials depends on inventory item type.

  1. Shopify requires storeName and token
  2. Ebay requires token and all extra values (storeName is required only if this store is sandbox - api.sandbox. Default value - api)
  • Returns:
{
  "onlineStore": {
    "id": {
      "ordinal": 1,
      "email": "email@email.com"
    },
    "arbitraryStoreName": "storeName",
    "type": "SHOPIFY"
  }
}

updateArbitraryStoreName

PUT /onlinestores/{currentName}?new={newName}
  • Returns:
{
  "onlineStore": {
    "id": {
      "ordinal": 1,
      "email": "email@email.com"
    },
    "arbitraryStoreName": "newName",
    "type": "SHOPIFY"
  }
}

deleteByArbitraryStoreName

DELETE /onlinestores/{name}
  • Returns:
{
  "status": 200, 
  "message": "Online store 'storeName' has been successfully deleted"
}

Products

getById

GET /inventoryitems/{id}
  • Returns:
{
  "id": 1,
  "inventoryId": "999999",
  "title": "Some title",
  "inventoryItem": {
    "productId": 999999,
    "title": "Some title"
  },
  "type": "SHOPIFY",
  "arbitraryStoreName": "storeName"
}

inventoryItem can have any json, depends on the type.

getAll

GET /inventoryitems
  • Returns:
{
  "inventoryItems": [
    {
      "id": 1,
      "inventoryId": "999999",
      "title": "Some title",
      "inventoryItem": {
        "productId": "999999",
        "title": "Some title"
      },
      "type": "SHOPIFY",
      "arbitraryStoreName": "storeName"
    },
    {
      "id": 2,
      "inventoryItem": {
        "title": "some product linker"
      },
      "mergedProducts": [
        {
          "id": 1,
          "inventoryId": "999999",
          "title": "Some title",
          "inventoryItem": {
            "productId": "999999",
            "title": "Some title"
          },
          "type": "SHOPIFY",
          "arbitraryStoreName": "storeName"
        }
      ],
      "type": "PRODUCT_LINKER"
    }
  ]
}

inventoryItem can have any json, depends on the type.

getAllByArbitraryStoreName

GET /onlinestores/{arbitraryStoreName}/inventoryitems
  • Returns:
{
  "inventoryItems": [
    {
      "id": 1,
      "inventoryId": "999999",
      "title": "Some title",
      "inventoryItem": {
        "productId": "999999",
        "title": "Some title"
      },
      "type": "SHOPIFY",
      "arbitraryStoreName": "storeName"
    }
  ]
}

inventoryItem can have any json, depends on the type.

create

POST /onlinestores/{arbitraryStoreName}/inventoryitems
  • Body (can have any json, depends on the type.):
{
  "productId": "999999",
  "title": "Some title"
}
  • Returns:
{
  "id": 1,
  "inventoryId": "999999",
  "title": "Some title",
  "inventoryItem": {
    "productId": "999999",
    "title": "Some title"
  },
  "type": "SHOPIFY",
  "arbitraryStoreName": "storeName"
}

update

PUT /inventoryitems/{id}
  • Body (can have any json, depends on the type):
{
  "productId": "999999",
  "title": "Some updated title"
}
  • Returns:
{
  "id": 1,
  "inventoryId": "999999",
  "title": "Some updated title",
  "inventoryItem": {
    "productId": "999999",
    "title": "Some updated title"
  },
  "type": "SHOPIFY",
  "arbitraryStoreName": "storeName"
}

delete

DELETE /inventoryitems/{id}
  • Returns:
{
  "status": 200,
  "message": "Product with id '1' has been successfully deleted"
}

merge

POST /inventoryitems/merge?id=1,2
  • Body (can have any json):
{
  "title": "some product linker"
}
  • Returns:
{
  "id": 1,
  "inventoryItem": {
    "title": "some product linker"
  },
  "mergedProducts": [
    {
      "id": 1,
      "productId": 888888,
      "title": "Some title",
      "inventoryItem": {
        "productId": 888888,
        "title": "Some title"
      },
      "type": "SHOPIFY",
      "arbitraryStoreName": "storeName"
    },
    {
      "id": 2,
      "productId": 999999,
      "title": "Some title",
      "inventoryItem": {
        "productId": 999999,
        "title": "Some title"
      },
      "type": "AMAZON",
      "arbitraryStoreName": "anotherStoreName"
    }
  ],
  "type": "PRODUCT_LINKER"
}

updateProductList

POST /inventoryitems/update
  • Returns:
{
  "status": 200,
  "message": "Product list has been successfully updated"
}

Response If there is some problem

{
  "status": STATUS_CODE,
  "message": "MESSAGE"
}

About

Inventory Management System

License:MIT License


Languages

Language:Java 83.5%Language:Kotlin 16.3%Language:Dockerfile 0.2%