Skip to content

Terminal weight capture, validation, and push to Quickbase API.

License

Notifications You must be signed in to change notification settings

bycarter/QuickbaseWeightSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quickbase Weight Sync

A simple terminal app to receive and validate scale input into a database, and then push the data into a Quickbase app.

Prerequisites

  • NodeJS
  • PostgreSQL 15.6 (required version)
# Install on Mac with Homebrew
brew install postgresql@15

Setup Steps

  1. PostgreSQL Setup:
    • Start PostgreSQL service:
brew services start postgresql@15
  • Create your user database if psql doesn't work:
createdb $USER
  • Create the application database:
createdb carts
  • Connect to database and create table:
psql carts
  1. Create Database Table:
CREATE TABLE control_records(
    id serial PRIMARY KEY,
    tray_n int NOT NULL,
    cell_n int NOT NULL,
    tare numeric(5, 3),
    gross numeric(5, 3),
    c_gross numeric(5, 3),
    created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    prod_order int NOT NULL,
    net numeric(5, 3),
    p_error numeric(5, 3),
    in_spec bool
);
  1. Install Node.js Dependencies:
npm install
  1. Environment Setup:
    • Create .env file in project root
    • Add required configuration values:
# PG Params
PGUSER=           # Your system username
PGPASSWORD=       # Leave blank if no password set
PGHOST=localhost
PGPORT=5432
PGDATABASE=carts

# Quickbase Auth Params
QB_PAT='QB-USER-TOKEN < USER TOKEN >'
QB_HOSTNAME='< company_name >.quickbase.com'
QB_USER_AGENT=

# Quickbase variables
#QB_TABLE_ID=
#QB_PO_ID=

# KEY MMR: 0.9 == 7, 0.5 == 6, 0.3 == 8
#QB_MMR=

# KEY PROD ID: 0.9 == 272, 0.5 == 275, 0.3 == 276
#QB_PROD_ID=
#QB_NUM_CARTS=
#CART_SIZE=

Troubleshooting

  1. If psql command doesn't work:
createdb $USER  # Create database matching your username
  1. Check PostgreSQL version:
psql --version  # Should show 15.x
  1. Verify database connection:
psql carts
\dt  # Should show control_records table

Version Requirements

  • PostgreSQL: 15.6
  • Node.js: See package.json
  • Required npm packages:
    • dotenv
    • json-templates
    • pg
    • readline-sync

About

Terminal weight capture, validation, and push to Quickbase API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published