Git Product home page Git Product logo

antevorta-backend's Introduction

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 protected]",
  "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 protected]",
  "password": "password"
}
  • Returns:
{
  "status": 201,
  "message": "Signed up successfully"
}

User

getUserinfo

GET /user
  • Returns:
{
  "user": {
    "id": 1,
    "email": "[email protected]",
    "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": "[email protected]",
    "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 protected]"
      },
      "arbitraryStoreName": "storeName",
      "type": "SHOPIFY"
    },
    {
      "id": {
        "ordinal": 2,
        "email": "[email protected]"
      },
      "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 protected]"
    },
    "arbitraryStoreName": "storeName",
    "type": "SHOPIFY"
  }
}

updateArbitraryStoreName

PUT /onlinestores/{currentName}?new={newName}
  • Returns:
{
  "onlineStore": {
    "id": {
      "ordinal": 1,
      "email": "[email protected]"
    },
    "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"
}

antevorta-backend's People

Contributors

rukins avatar

Watchers

 avatar mxmdev 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.