vr-commons 1.0.150 → 1.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -85,7 +85,7 @@ export declare const stockUtil: {
|
|
|
85
85
|
/**
|
|
86
86
|
* Check if pair exists and is not soft deleted
|
|
87
87
|
*/
|
|
88
|
-
checkPairExists(pairId: string,
|
|
88
|
+
checkPairExists(pairId: string, transaction?: any): Promise<{
|
|
89
89
|
exists: boolean;
|
|
90
90
|
devices?: Device[];
|
|
91
91
|
missing?: string[];
|
|
@@ -93,7 +93,7 @@ export declare const stockUtil: {
|
|
|
93
93
|
/**
|
|
94
94
|
* Check if pair IDs exist and are not soft deleted (for bulk operations)
|
|
95
95
|
*/
|
|
96
|
-
checkMultiplePairsExist(pairIds: string[],
|
|
96
|
+
checkMultiplePairsExist(pairIds: string[], transaction?: any): Promise<{
|
|
97
97
|
valid: boolean;
|
|
98
98
|
existingPairs: string[];
|
|
99
99
|
missingPairs: string[];
|
|
@@ -292,11 +292,10 @@ exports.stockUtil = {
|
|
|
292
292
|
/**
|
|
293
293
|
* Check if pair exists and is not soft deleted
|
|
294
294
|
*/
|
|
295
|
-
async checkPairExists(pairId,
|
|
295
|
+
async checkPairExists(pairId, transaction) {
|
|
296
296
|
const devices = await vr_models_1.Device.findAll({
|
|
297
297
|
where: {
|
|
298
298
|
pairId: pairId,
|
|
299
|
-
productId: productId,
|
|
300
299
|
deletedAt: null, // ✅ Exclude soft deleted
|
|
301
300
|
},
|
|
302
301
|
transaction,
|
|
@@ -320,12 +319,12 @@ exports.stockUtil = {
|
|
|
320
319
|
/**
|
|
321
320
|
* Check if pair IDs exist and are not soft deleted (for bulk operations)
|
|
322
321
|
*/
|
|
323
|
-
async checkMultiplePairsExist(pairIds,
|
|
322
|
+
async checkMultiplePairsExist(pairIds, transaction) {
|
|
324
323
|
const existingPairs = [];
|
|
325
324
|
const missingPairs = [];
|
|
326
325
|
const incompletePairs = [];
|
|
327
326
|
for (const pairId of pairIds) {
|
|
328
|
-
const result = await this.checkPairExists(pairId,
|
|
327
|
+
const result = await this.checkPairExists(pairId, transaction);
|
|
329
328
|
if (!result.exists) {
|
|
330
329
|
if (result.devices && result.devices.length === 1) {
|
|
331
330
|
incompletePairs.push(pairId);
|