accumulate stock deltas before campaigns
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 52s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 52s
This commit is contained in:
@@ -2,7 +2,7 @@ const { pool } = require('../db');
|
||||
const { normalizeStockPayload } = require('../mappers/stockMapper');
|
||||
const { enqueueStockCampaignItem } = require('./campaignService');
|
||||
|
||||
const CAMPAIGN_DELTA_THRESHOLD = 100;
|
||||
const POSITIVE_STOCK_DELTA_THRESHOLD = 1;
|
||||
|
||||
const listStock = async () => {
|
||||
const result = await pool.query('SELECT * FROM stock');
|
||||
@@ -36,7 +36,7 @@ const upsertStockItems = async (payload) => {
|
||||
item.deltaEstoque
|
||||
]);
|
||||
|
||||
if (item.deltaEstoque >= CAMPAIGN_DELTA_THRESHOLD) {
|
||||
if (item.deltaEstoque >= POSITIVE_STOCK_DELTA_THRESHOLD) {
|
||||
await enqueueStockCampaignItem(client, item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user