tango-app-api-infra 3.9.22 → 3.9.24
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
|
@@ -844,7 +844,7 @@ export async function ticketSummary( req, res ) {
|
|
|
844
844
|
return res.sendError( 'this client not configured against footfall directory', 400 );
|
|
845
845
|
}
|
|
846
846
|
let isApprover = false;
|
|
847
|
-
revisionArray = getConfig?.footfallDirectoryConfigs?.revision || [];
|
|
847
|
+
const revisionArray = getConfig?.footfallDirectoryConfigs?.revision || [];
|
|
848
848
|
if ( Array.isArray( revisionArray ) && revisionArray.length > 0 ) {
|
|
849
849
|
for ( const r of revisionArray ) {
|
|
850
850
|
if ( r.actionType === 'approver' && r.isChecked === false ) {
|
|
@@ -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';
|
|
@@ -2716,6 +2719,55 @@ export async function ticketList( req, res ) {
|
|
|
2716
2719
|
},
|
|
2717
2720
|
];
|
|
2718
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;
|
|
2719
2771
|
case 'dueDate':
|
|
2720
2772
|
searchQuery.sort = [
|
|
2721
2773
|
{
|