- Node v20
npm installnpm testThis 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.
inventoryinventory data schemainventory- inventory data at the SkuBatch + Warehouse-levelinventory_aggregate- inventory data at the SkuBatch-level
appweb app schemaSku- a unique productBatch- a batch of harvest materialSkuBatch- a Sku that is created from a specific batch
Skua SKU is a unique product - think a 1.0 gram Maui Wowie vape cartridgeBatcha SKU is created by different harvest material, a SKU is crafted from multiple batchesSkuBatcha 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.WMSWarehouse 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.tsinformatSqlValue - 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
inventorydatabase. 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
/inventoryendpoint accepts POST and PUT. TheskuBatchId,skuId, andwarehouseIdfields are required. - The
/inventory-aggregateendpoint accepts POST and PUT. TheskuBatchIdandskuIdfields are required. - The body of the request payload should be JSON with the required keys/values.
- The fake API endpoint should be