tango-app-api-audit 3.4.3-alpha.11 → 3.4.3-alpha.12
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.
package/package.json
CHANGED
|
@@ -1103,9 +1103,9 @@ export async function workSpace( req, res ) {
|
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
1105
1105
|
if ( inputData.isExport ) {
|
|
1106
|
-
const
|
|
1106
|
+
const exportData = [];
|
|
1107
1107
|
temp.forEach( ( element ) => {
|
|
1108
|
-
|
|
1108
|
+
exportData.push( {
|
|
1109
1109
|
'Client Name': element.clientName,
|
|
1110
1110
|
'Client Id': element.clientId,
|
|
1111
1111
|
'Completed stores Count': element.completedStoresCount,
|
|
@@ -1116,7 +1116,7 @@ export async function workSpace( req, res ) {
|
|
|
1116
1116
|
'Assigned': element.Assignedcount,
|
|
1117
1117
|
} );
|
|
1118
1118
|
} );
|
|
1119
|
-
await download(
|
|
1119
|
+
await download( exportData, res );
|
|
1120
1120
|
return;
|
|
1121
1121
|
} else {
|
|
1122
1122
|
return res.sendSuccess( {
|
|
@@ -2165,10 +2165,10 @@ export async function storeMetrics( req, res ) {
|
|
|
2165
2165
|
}
|
|
2166
2166
|
const result = await aggregateStoreAudit( query );
|
|
2167
2167
|
if ( inputData.isExport ) {
|
|
2168
|
-
const
|
|
2168
|
+
const exportData = [];
|
|
2169
2169
|
result.forEach( ( element ) => {
|
|
2170
2170
|
if ( element.moduleType == 'zone' ) {
|
|
2171
|
-
|
|
2171
|
+
exportData.push( {
|
|
2172
2172
|
'File Date': element.fileDate,
|
|
2173
2173
|
'Store ID': element.storeId,
|
|
2174
2174
|
'Store Name': element.storeName,
|
|
@@ -2185,7 +2185,7 @@ export async function storeMetrics( req, res ) {
|
|
|
2185
2185
|
'Status': element.status,
|
|
2186
2186
|
} );
|
|
2187
2187
|
} else {
|
|
2188
|
-
|
|
2188
|
+
exportData.push( {
|
|
2189
2189
|
'File Date': element.fileDate,
|
|
2190
2190
|
'Store ID': element.storeId,
|
|
2191
2191
|
'Store Name': element.storeName,
|
|
@@ -2202,7 +2202,7 @@ export async function storeMetrics( req, res ) {
|
|
|
2202
2202
|
} );
|
|
2203
2203
|
}
|
|
2204
2204
|
} );
|
|
2205
|
-
await download(
|
|
2205
|
+
await download( exportData, res );
|
|
2206
2206
|
return;
|
|
2207
2207
|
}
|
|
2208
2208
|
return res.sendSuccess( { result: result, count: count.length } );
|
|
@@ -2621,10 +2621,10 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2621
2621
|
|
|
2622
2622
|
const result = await aggregateUserAudit( query );
|
|
2623
2623
|
if ( inputData.isExport ) {
|
|
2624
|
-
const
|
|
2624
|
+
const exportData = [];
|
|
2625
2625
|
result.forEach( ( element ) => {
|
|
2626
2626
|
if ( element.moduleType == 'zone' ) {
|
|
2627
|
-
|
|
2627
|
+
exportData.push( {
|
|
2628
2628
|
'Store ID': element.storeId,
|
|
2629
2629
|
'zoneName': element.zoneName,
|
|
2630
2630
|
'File Date': element.fileDate,
|
|
@@ -2637,7 +2637,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2637
2637
|
'Status': element.auditStatus,
|
|
2638
2638
|
} );
|
|
2639
2639
|
} else {
|
|
2640
|
-
|
|
2640
|
+
exportData.push( {
|
|
2641
2641
|
'Store ID': element.storeId,
|
|
2642
2642
|
'File Date': element.fileDate,
|
|
2643
2643
|
'Product Type': element.moduleType,
|
|
@@ -2650,7 +2650,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2650
2650
|
} );
|
|
2651
2651
|
}
|
|
2652
2652
|
} );
|
|
2653
|
-
await download(
|
|
2653
|
+
await download( exportData, res );
|
|
2654
2654
|
return;
|
|
2655
2655
|
}
|
|
2656
2656
|
return res.sendSuccess( { result: result, count: count.length } );
|
|
@@ -2939,6 +2939,7 @@ export async function overViewCard( req, res ) {
|
|
|
2939
2939
|
inprogressCount: 0,
|
|
2940
2940
|
completedCount: 0,
|
|
2941
2941
|
pendingCount: 0,
|
|
2942
|
+
notAssigned: 0,
|
|
2942
2943
|
};
|
|
2943
2944
|
|
|
2944
2945
|
const dateRange = await getUTC( new Date( inputData.fromDate ), new Date( inputData.toDate ) );
|
|
@@ -2969,7 +2970,7 @@ export async function overViewCard( req, res ) {
|
|
|
2969
2970
|
},
|
|
2970
2971
|
inprogressCount: {
|
|
2971
2972
|
$cond: [
|
|
2972
|
-
{ $
|
|
2973
|
+
{ $in: [ '$status', [ 'inprogress', 'assigned', 'drafted' ] ] }, 1, 0,
|
|
2973
2974
|
],
|
|
2974
2975
|
},
|
|
2975
2976
|
completedCount: {
|
|
@@ -3196,7 +3197,10 @@ export async function summarySplit( req, res ) {
|
|
|
3196
3197
|
];
|
|
3197
3198
|
const result = await aggregateStoreAudit( query );
|
|
3198
3199
|
const totalCount = await aggregateAuditStoreData( totalQuery );
|
|
3199
|
-
|
|
3200
|
+
if ( totalCount.length> 0 ) {
|
|
3201
|
+
result[0].totalCount = totalCount[0]?.total;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3200
3204
|
return res.sendSuccess( { result: result.length > 0 ? result[0] : temp } );
|
|
3201
3205
|
} catch ( error ) {
|
|
3202
3206
|
const err = error.message || 'Internal Server Error';
|
|
@@ -3337,38 +3341,32 @@ export async function overviewTable( req, res ) {
|
|
|
3337
3341
|
|
|
3338
3342
|
const result = await aggregateStoreAudit( query );
|
|
3339
3343
|
if ( inputData.isExport ) {
|
|
3340
|
-
const
|
|
3344
|
+
const exportData = [];
|
|
3341
3345
|
result.forEach( ( element ) => {
|
|
3342
3346
|
if ( element.moduleType == 'zone' ) {
|
|
3343
|
-
|
|
3344
|
-
'
|
|
3347
|
+
exportData.push( {
|
|
3348
|
+
'File Date': element.fileDate,
|
|
3345
3349
|
'Brand ID': element.clientId,
|
|
3350
|
+
'Store ID': element.storeId,
|
|
3346
3351
|
'Zone Name': element.zoneName,
|
|
3347
|
-
'File Date': element.fileDate,
|
|
3348
|
-
'Product Type': element.moduleType,
|
|
3349
|
-
'Audit Type': element.auditType,
|
|
3350
3352
|
'Before Count': element.beforeCount,
|
|
3351
3353
|
'After Count': element.afterCount,
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
'Status': element.status,
|
|
3354
|
+
'Audit Type': element.auditType,
|
|
3355
|
+
'Status': toCamelCase( element.status ),
|
|
3355
3356
|
} );
|
|
3356
3357
|
} else {
|
|
3357
|
-
|
|
3358
|
-
'Store ID': element.storeId,
|
|
3359
|
-
'Brand ID': element.clientId,
|
|
3358
|
+
exportData.push( {
|
|
3360
3359
|
'File Date': element.fileDate,
|
|
3361
|
-
'
|
|
3362
|
-
'
|
|
3360
|
+
'Brand ID': element.clientId,
|
|
3361
|
+
'Store ID': element.storeId,
|
|
3363
3362
|
'Before Count': element.beforeCount,
|
|
3364
3363
|
'After Count': element.afterCount,
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
'Status': element.status,
|
|
3364
|
+
'Audit Type': element.auditType,
|
|
3365
|
+
'Status': toCamelCase( element.status ),
|
|
3368
3366
|
} );
|
|
3369
3367
|
}
|
|
3370
3368
|
} );
|
|
3371
|
-
await download(
|
|
3369
|
+
await download( exportData, res );
|
|
3372
3370
|
return;
|
|
3373
3371
|
}
|
|
3374
3372
|
return res.sendSuccess( { result: result, count: count.length } );
|
|
@@ -3379,6 +3377,18 @@ export async function overviewTable( req, res ) {
|
|
|
3379
3377
|
}
|
|
3380
3378
|
}
|
|
3381
3379
|
|
|
3380
|
+
export function toCamelCase( str ) {
|
|
3381
|
+
logger.info( { str: str } );
|
|
3382
|
+
return str
|
|
3383
|
+
.split( '-' ) // Split the string by spaces
|
|
3384
|
+
.map( ( word, index ) =>
|
|
3385
|
+
// index === 0 ?
|
|
3386
|
+
// word.toLowerCase() : // Lowercase the first word
|
|
3387
|
+
word.charAt( 0 ).toUpperCase() + word.slice( 1 ).toLowerCase(), // Capitalize the first letter of subsequent words
|
|
3388
|
+
)
|
|
3389
|
+
.join( '' ); // Join the words without spaces
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3382
3392
|
export async function totalNotAssignedCount( req, res ) {
|
|
3383
3393
|
try {
|
|
3384
3394
|
let notAssignedCount = {
|
|
@@ -3625,39 +3625,42 @@ export async function overviewTable( req, res ) {
|
|
|
3625
3625
|
const exportdata = [];
|
|
3626
3626
|
result.forEach( ( element ) => {
|
|
3627
3627
|
const temp ={
|
|
3628
|
-
'Store ID': element.storeId,
|
|
3629
|
-
'Brand ID': element.clientId,
|
|
3630
3628
|
'File Date': element.fileDate,
|
|
3631
|
-
'
|
|
3632
|
-
'
|
|
3633
|
-
'Audit Type': element.auditType,
|
|
3634
|
-
// 'User Name': element.userName,
|
|
3635
|
-
// 'User Email': element.userEmail,
|
|
3636
|
-
'Status': element.status,
|
|
3637
|
-
'Audit Status': element.status,
|
|
3629
|
+
'Brand ID': element.clientId,
|
|
3630
|
+
'Store ID': element.storeId,
|
|
3638
3631
|
};
|
|
3639
3632
|
|
|
3640
3633
|
switch ( inputData.moduleType ) {
|
|
3641
3634
|
case 'camera-angle-change':
|
|
3642
3635
|
temp['stream Name'] = element.streamName;
|
|
3643
3636
|
temp['User Comments'] = element.userComments;
|
|
3637
|
+
temp['Audit Type'] = element.auditType;
|
|
3638
|
+
temp['Status'] = element.auditStatus;
|
|
3644
3639
|
break;
|
|
3645
3640
|
case 'unattended-customer':
|
|
3646
3641
|
temp['Customer ID'] = element.tempId;
|
|
3647
3642
|
temp['Question'] = element.question;
|
|
3648
3643
|
temp['User Comments'] = element.userComments;
|
|
3644
|
+
temp['Audit Type'] = element.auditType;
|
|
3645
|
+
temp['Status'] = element.auditStatus;
|
|
3649
3646
|
break;
|
|
3650
3647
|
case 'left-in-middle':
|
|
3651
3648
|
temp['Question'] = element.question;
|
|
3652
3649
|
temp['User Comments'] = element.userComments;
|
|
3650
|
+
temp['Audit Type'] = element.auditType;
|
|
3651
|
+
temp['Status'] = element.auditStatus;
|
|
3653
3652
|
break;
|
|
3654
3653
|
case 'mobile-detection':
|
|
3655
3654
|
temp['Before Count'] = element.beforeCount;
|
|
3656
3655
|
temp['After Count'] = element.afterCount;
|
|
3656
|
+
temp['Audit Type'] = element.auditType;
|
|
3657
|
+
temp['Status'] = element.status;
|
|
3657
3658
|
break;
|
|
3658
3659
|
case 'uniform-detection':
|
|
3659
3660
|
temp['Before Count'] = element.beforeCount;
|
|
3660
3661
|
temp['After Count'] = element.afterCount;
|
|
3662
|
+
temp['Audit Type'] = element.auditType;
|
|
3663
|
+
temp['Status'] = element.status;
|
|
3661
3664
|
break;
|
|
3662
3665
|
}
|
|
3663
3666
|
exportdata.push( temp );
|