- Node v20
npm install
npm test
This is a NodeJS project that comes from one of our production services that is responsible
for synchronizing data between two different Postgres databases. This service is responsible for finding
deltas between the app
database and the inventory
database then creating proper representations in
the inventory
database.
A better description may be the following case:
A new product is created in the app
database. Our service will find that new product and create a
corresponding record for that new product in the inventory
database.
This project requires no database connection. The data calls are mocked with simple JSON
that is defined in ./src/db/data.ts
.
The entrypoint is at the very bottom of sync.ts
, the function is named sync
.
inventory
inventory data schemainventory
- inventory data at the SkuBatch + Warehouse-levelinventory_aggregate
- inventory data at the SkuBatch-level
app
web app schemaSku
- a unique productBatch
- a batch of harvest materialSkuBatch
- a Sku that is created from a specific batch
Sku
a SKU is a unique product - think a 1.0 gram Maui Wowie vape cartridgeBatch
a SKU is created by different harvest material, a SKU is crafted from multiple batchesSkuBatch
a SkuBatch is a SKU that is created from a specific batch - it is the unique tuple that represents a distinct Sku created from a distinct Batch.WMS
Warehouse Management System - the system that manages inventory in the warehouse
- Find the bugs in the codebase and fix them
- Implement the requested functional in
./src/db/sql.util.ts
informatSqlValue
- Implement the functional as requested in the comment on line 176 of
sync.ts
- Complete the commented out tests in
sync.spec.ts
- Envision us now not making the inserts and updates directly to the
inventory
database. Implement the ability to make the necessary POST/PUT request to an API endpoint to create/update the inventory records (instead of making updates directly).- The fake API endpoint should be
https://local-inventory.nabis.dev/v1/
- The
/inventory
endpoint accepts POST and PUT. TheskuBatchId
,skuId
, andwarehouseId
fields are required. - The
/inventory-aggregate
endpoint accepts POST and PUT. TheskuBatchId
andskuId
fields are required. - The body of the request payload should be JSON with the required keys/values.
- The fake API endpoint should be