Sachin/barcode scan async issue#507
Conversation
imsks
commented
Sep 8, 2021
- Fixed Barcode scan issues
- Added Dexie to store data into Index DB
- Created API Queue table to call APIs in the background
…inPal/StockUp into sachin/barcode-async-issue
…inPal/StockUp into sachin/barcode-async-issue
| @@ -0,0 +1,4 @@ | |||
| sudo docker-compose logs -f admin | |||
| "lockfileVersion": 1, | ||
| "requires": true, | ||
| "dependencies": { | ||
| "@sentry/apm": { |
There was a problem hiding this comment.
Dont commit files you haven't worked on
There was a problem hiding this comment.
Please remove these changes
Check changes in source tree before committing
| image: nginx:stable | ||
| ports: | ||
| - "80:80" | ||
| - "81:80" |
| production: false, | ||
| API_URL: '/api', | ||
| BASE_URL: '', | ||
| BASE_URL: 'https://stockup-staging.shoppinpal.com', |
| import { Injectable } from "@angular/core"; | ||
|
|
||
| // Declare Database | ||
| class ProductDatabase extends Dexie { |
There was a problem hiding this comment.
Why two different database classes?
There was a problem hiding this comment.
ProductDatabase is for storing products & APIQueueDatabase is for API queing
There was a problem hiding this comment.
found this on documentation, have a look
https://www.evernote.com/l/AnH1PbFc3bdPlI_uQUN6HBf12Z5n1MZXaDYB/image.png
| if (!searchedOrderItem.received) { | ||
| this.notReceivedLineItems = [searchedOrderItem]; | ||
| } else { | ||
| async scanBarcodeAPI(sku?: string, force: boolean = false) { |
There was a problem hiding this comment.
duplicate code
this code already exists in barcode service
Can we reuse it ?
| import Dexie from "dexie"; | ||
|
|
||
| // Declare Database | ||
| class ProductDatabase extends Dexie { |
There was a problem hiding this comment.
Why do we have two database classes ?
Please use I class/database to contain both tables
There was a problem hiding this comment.
Both table have different functions and that's why it'll be confusing to use a single class
| super("APIQueueDatabase"); | ||
|
|
||
| this.version(1).stores({ | ||
| skus: "++id, sku", |
There was a problem hiding this comment.
table name skus doesn't make sense
There was a problem hiding this comment.
It'll only hold skus in rows to call the APIs
|
|
||
| export interface BarcodeReceive { | ||
| sku: string; | ||
| done: boolean; |
There was a problem hiding this comment.
I dont see any use of done argument in this file ?
Why we have less parameters in skus table but the type has more parameters ?
Please add the missing parameters in skus table definition in db class
There was a problem hiding this comment.
We don't need any more data in skus. It works expected now
| @@ -0,0 +1,33 @@ | |||
| import Dexie from "dexie"; | |||
There was a problem hiding this comment.
There is another file that does the same thing
indexdb.service.ts
Please delete this file and use the angular service instead