Giter VIP home page Giter VIP logo

openap-inventory-manager's Introduction

OpenAP Inventory Manager

This is a set of two libraries to be used with Next JS to allow you to manage your company's inventory in OpenAP. We generate two packages that are published for use:

  • A front-end library (openap-inventory-manager-react) which is a set of React UI components and styles.
  • A server library (openap-inventory-manager-server) which is a set of GraphQL resolvers and schemas, a database client for persisting relevant data, and a background worker to handle syncing with OpenAP and your database.

Requirements

  • Nodejs >= 16
  • PostgresQL >= 10
  • Typescript >= 4
  • Next JS >= 11
  • React >= 17 (we recommend Redux Toolkit >= 1.4)
  • Redux >= 4 (we recommend Redux Toolkit >= 1.4)

Installation

To install the front-end lib:

$ npm install @viacomcbs/openap-inventory-manager-react

To install the server lib:

$ npm install @viacomcbs/openap-inventory-manager-server

For more details on how to use each package, importing components, etc., see the respective READMEs:

Quickstart

The easiest way to start is to use our Next.js template. It will create everything you need to get up and running. The repo and instructions can be found here: OpenAP Next JS Template

Configuration

Environment variables

There are certain ENV variables you need to set for these packages to work. You can use tools like dotenv-flow or direnv to handle this.

All environments

  • APP_URL - The base url for this app when running.
  • LOG_LEVEL - error, info, debug, silent.
  • DATABASE_URL - The url of your database, e.g., postgres://user:pwd@host:port/my_database
  • OPENAP_PUBLISHERS_IDS - supported Open AP publishers ids, e.g., 1 or 1,2
  • OPENAP_API_URL - the base Open AP url for the env, e.g., https://api-uat.openap-acn.com/v1
  • OPENAP_API_CLIENT_ID - your Open AP client ID
  • OPENAP_API_USER_ID - your env Open AP user id
  • OPENAP_API_PASSWORD - your env Open AP password
  • OPENAP_API_CODE - your env Open AP api code
  • OPENAP_API_GRANT_TYPE - open ap api grant type. Usually: password
  • OPENAP_API_GRANT_SCOPE - open ap api grant scope, e.g., openid OpenAPScopes mail uid orgid orgtype usertype

Setting up the Database

IMPORTANT: We highly recommend you run this migration command as part of your deploy pipeline so your manager schema is kept up to date after any library upgrades.

This library maintains it's own database tables it needs to function under it's own DB Schema. It defaults to manager, but if you'd like to customize it, you can set an env var: OPENAP_SCHEMA.

Once you've installed the library, you can run the DB migrations needed by:

./node_modules/.bin/openap-migrate-manager

If you'd like you can add it as a script to your package.json:

...
  "scripts": {
    "migrate:manager": "openap-migrate-manager"
  },
...

And you can also pass a optional direction -d to the script to migrate up or down (defaults to up). E.g.:

$ npm run migrate:manager -- -d down

Development

We love pull requests! If you'd like to contribute to this project, please see our CONTRIBUTING.md guide.

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.