tango-app-api-infra 3.9.21 → 3.9.23
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
|
@@ -2611,7 +2611,7 @@ export async function ticketList( req, res ) {
|
|
|
2611
2611
|
if ( inputData.sortBy ) {
|
|
2612
2612
|
let sortOrder = inputData.sortOrder === 1 ? 'asc' : 'desc';
|
|
2613
2613
|
const stringKeywordFields = [ 'storeName', 'storeId', 'ticketId', 'status', 'type', 'clientId' ];
|
|
2614
|
-
let sortField = inputData.sortBy == 'footfall' ? 'footfallCount' : inputData.sortBy == 'issueDate' ? 'dateString': inputData.sortBy == 'tangoStatus'? 'status' : inputData.sortBy;
|
|
2614
|
+
let sortField = inputData.sortBy == 'footfall' ? 'footfallCount' :inputData.sortBy == 'revisedFF' ? 'revicedFootfall' : inputData.sortBy == 'issueDate' ? 'dateString': inputData.sortBy == 'tangoStatus'? 'status' : inputData.sortBy;
|
|
2615
2615
|
if ( stringKeywordFields.includes( sortField ) ) {
|
|
2616
2616
|
sortField = `${sortField}.keyword`;
|
|
2617
2617
|
}
|
|
@@ -2624,6 +2624,9 @@ export async function ticketList( req, res ) {
|
|
|
2624
2624
|
} else if ( inputData.sortBy === 'dueDate' ) {
|
|
2625
2625
|
sortKey = 'dueDate';
|
|
2626
2626
|
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
2627
|
+
} else if ( inputData.sortBy === 'closedDate' ) {
|
|
2628
|
+
sortKey = 'updatedAt';
|
|
2629
|
+
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
2627
2630
|
} else if ( inputData.sortBy === 'storeRevisedAccuracy' ) {
|
|
2628
2631
|
sortKey = 'revicedPerc';
|
|
2629
2632
|
requestedSortType = 'tagging';
|
|
@@ -2645,6 +2648,9 @@ export async function ticketList( req, res ) {
|
|
|
2645
2648
|
} else if ( inputData.sortBy === 'ticketBy' ) {
|
|
2646
2649
|
sortKey = 'createdByEmail';
|
|
2647
2650
|
requestedSortType = 'tangoreview';
|
|
2651
|
+
} else if ( inputData.sortBy === 'ticketCreatedBy' ) {
|
|
2652
|
+
sortKey = 'createdByEmail';
|
|
2653
|
+
requestedSortType = 'tagging';
|
|
2648
2654
|
} else if ( inputData.sortBy === 'status' ) {
|
|
2649
2655
|
sortKey = 'status';
|
|
2650
2656
|
requestedSortType =( req.user.userType === 'tango' && inputData.tangoType === 'store' )? 'tangoreview' : inputData?.permissionType === 'review' ? 'review' : ( ticketsFeature && !ticketsApproveFeature )? 'review':'approve';
|
|
@@ -2713,6 +2719,55 @@ export async function ticketList( req, res ) {
|
|
|
2713
2719
|
},
|
|
2714
2720
|
];
|
|
2715
2721
|
break;
|
|
2722
|
+
case 'updatedAt':
|
|
2723
|
+
searchQuery.sort = [
|
|
2724
|
+
{
|
|
2725
|
+
_script: {
|
|
2726
|
+
type: 'number',
|
|
2727
|
+
script: {
|
|
2728
|
+
lang: 'painless',
|
|
2729
|
+
source: `
|
|
2730
|
+
try {
|
|
2731
|
+
if (params['_source']['mappingInfo'] != null) {
|
|
2732
|
+
def found = null;
|
|
2733
|
+
for (item in params['_source']['mappingInfo']) {
|
|
2734
|
+
if (item != null && item['type'] == params['miType'] && item['updatedAt'] != null) {
|
|
2735
|
+
def millis = 0;
|
|
2736
|
+
if (item['updatedAt'] instanceof String) {
|
|
2737
|
+
// If string, attempt Date conversion (ISO8601)
|
|
2738
|
+
millis = ZonedDateTime.parse(item['updatedAt']).toInstant().toEpochMilli();
|
|
2739
|
+
} else if (item['updatedAt'] instanceof def && item['updatedAt'].getMillis != null) {
|
|
2740
|
+
millis = item['updatedAt'].getMillis();
|
|
2741
|
+
}
|
|
2742
|
+
if (found == null || millis > found) {
|
|
2743
|
+
found = millis;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
if (found != null) return found;
|
|
2748
|
+
}
|
|
2749
|
+
} catch (Exception e) {
|
|
2750
|
+
// Fallback below
|
|
2751
|
+
}
|
|
2752
|
+
// fallback: return record
|
|
2753
|
+
if (params['_source']['updatedAt'] != null) {
|
|
2754
|
+
if (params['_source']['updatedAt'] instanceof String) {
|
|
2755
|
+
return ZonedDateTime.parse(params['_source']['updatedAt']).toInstant().toEpochMilli();
|
|
2756
|
+
} else if (params['_source']['updatedAt'] instanceof def && params['_source']['updatedAt'].getMillis != null) {
|
|
2757
|
+
return params['_source']['updatedAt'].getMillis();
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
return 0;
|
|
2761
|
+
`,
|
|
2762
|
+
params: {
|
|
2763
|
+
miType: requestedSortType,
|
|
2764
|
+
},
|
|
2765
|
+
},
|
|
2766
|
+
order: sortOrder,
|
|
2767
|
+
},
|
|
2768
|
+
},
|
|
2769
|
+
];
|
|
2770
|
+
break;
|
|
2716
2771
|
case 'dueDate':
|
|
2717
2772
|
searchQuery.sort = [
|
|
2718
2773
|
{
|
|
@@ -4167,7 +4222,7 @@ export async function ticketList( req, res ) {
|
|
|
4167
4222
|
storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4168
4223
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4169
4224
|
...( isApprover !== true? item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc : '' ),
|
|
4170
|
-
|
|
4225
|
+
revisedFF: item.status === 'Closed' || item.status === 'Tango Review Done' ?item?.revicedFootfall : '--',
|
|
4171
4226
|
|
|
4172
4227
|
status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
|
|
4173
4228
|
closedDate: item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt : '--',
|
|
@@ -4285,7 +4340,7 @@ export async function ticketList( req, res ) {
|
|
|
4285
4340
|
storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
|
|
4286
4341
|
reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
|
|
4287
4342
|
...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '' ),
|
|
4288
|
-
|
|
4343
|
+
revisedFF: item.status === 'Closed' || item.status === 'Tango Review Done' ?item?.revicedFootfall : '--',
|
|
4289
4344
|
|
|
4290
4345
|
status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
|
|
4291
4346
|
closedDate: item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt : '--',
|