tango-app-api-infra 3.8.6 → 3.8.8
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
|
@@ -741,8 +741,9 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
741
741
|
duplicateStatus,
|
|
742
742
|
employeeStatus,
|
|
743
743
|
houseKeepingStatus,
|
|
744
|
+
junkStatus,
|
|
744
745
|
} = data;
|
|
745
|
-
const statusList = [ duplicateStatus, employeeStatus, houseKeepingStatus ];
|
|
746
|
+
const statusList = [ duplicateStatus, employeeStatus, houseKeepingStatus, junkStatus ];
|
|
746
747
|
// Filter out undefined/null statuses
|
|
747
748
|
const existingStatuses = statusList.filter( ( status ) => status != null );
|
|
748
749
|
|
|
@@ -762,7 +763,6 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
762
763
|
let bulkBody = [];
|
|
763
764
|
if ( data?.duplicateImages?.length > 0 ) {
|
|
764
765
|
updateData.duplicateImages = await mergeDuplicateImagesWithUncheck( getExistingOne?.body?._source?.duplicateImages, data?.duplicateImages, data?.duplicateStatus );
|
|
765
|
-
logger.info( { updateData: updateData, existeg: getExistingOne?.body?._source?.duplicateImages, sttaus: data?.duplicateStatus } );
|
|
766
766
|
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: updateData } );
|
|
767
767
|
for ( let duplicate of updateData?.duplicateImages ) {
|
|
768
768
|
bulkBody.push(
|
|
@@ -816,6 +816,27 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
816
816
|
}
|
|
817
817
|
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: { houseKeepingACCount: tempId?.length || 0 } } );
|
|
818
818
|
}
|
|
819
|
+
|
|
820
|
+
if ( data?.junk?.length > 0 ) {
|
|
821
|
+
const updateJunk = updateEmployeeCheckFlags(
|
|
822
|
+
source?.junk,
|
|
823
|
+
updateData?.junk,
|
|
824
|
+
data.junkStatus,
|
|
825
|
+
);
|
|
826
|
+
updateData.junk = updateJunk;
|
|
827
|
+
|
|
828
|
+
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: updateData } );
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
for ( let junk of updateData?.junk ) {
|
|
832
|
+
junk.isChecked == true ? tempId.push( { tempId: junk.tempId, timeRange: junk.timeRange } ) : null;
|
|
833
|
+
bulkBody.push(
|
|
834
|
+
{ update: { _index: openSearch.revop, _id: `${storeId}_${dateString}_${junk.timeRange}_${junk.tempId}` } },
|
|
835
|
+
{ doc: { isChecked: junk.isChecked, status: junk?.isChecked == true? 'approved':'rejected' } },
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: { junkACCount: tempId?.length || 0 } } );
|
|
839
|
+
}
|
|
819
840
|
temp.push( storeId );
|
|
820
841
|
if ( bulkBody.length > 0 ) {
|
|
821
842
|
const res = await bulkUpdate( bulkBody );
|
|
@@ -835,7 +856,6 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
835
856
|
const getStoreType = await countDocumnetsCamera( query );
|
|
836
857
|
let getUpdateExistingOne = await getOpenSearchById( openSearch.footfallDirectory, _id );
|
|
837
858
|
const tempIdList = await extractCheckedTempIds( getUpdateExistingOne?.body );
|
|
838
|
-
logger.info( { tempIdList: tempIdList } );
|
|
839
859
|
const isSendMessge = await sendSqsMessage( data, tempIdList, getStoreType, storeId );
|
|
840
860
|
if ( isSendMessge ==true ) {
|
|
841
861
|
return true; // res.sendSuccess( 'Ticket has been updated successfully' );
|
|
@@ -1075,10 +1095,10 @@ export async function getTaggedStores( req, res ) {
|
|
|
1075
1095
|
sum: {
|
|
1076
1096
|
script: {
|
|
1077
1097
|
source: `
|
|
1078
|
-
return (doc.containsKey('duplicateCount') ? doc['duplicateCount'].value : 0)
|
|
1079
|
-
+ (doc.containsKey('houseKeepingCount') ? doc['houseKeepingCount'].value : 0)
|
|
1080
|
-
+ (doc.containsKey('employeeCount') ? doc['employeeCount'].value : 0)
|
|
1081
|
-
|
|
1098
|
+
return (doc.containsKey('duplicateCount')&& !doc['duplicateCount'].empty ? doc['duplicateCount'].value : 0)
|
|
1099
|
+
+ (doc.containsKey('houseKeepingCount') && !doc['houseKeepingCount'].empty ? doc['houseKeepingCount'].value : 0)
|
|
1100
|
+
+ (doc.containsKey('employeeCount') && !doc['employeeCount'].empty ? doc['employeeCount'].value : 0)
|
|
1101
|
+
+ (doc.containsKey('junkCount') && !doc['junkCount'].empty ? doc['junkCount'].value : 0);
|
|
1082
1102
|
`,
|
|
1083
1103
|
lang: 'painless',
|
|
1084
1104
|
},
|
|
@@ -1096,10 +1116,10 @@ export async function getTaggedStores( req, res ) {
|
|
|
1096
1116
|
}
|
|
1097
1117
|
|
|
1098
1118
|
const response = geteDataCount?.body?.aggregations?.unique_stores?.buckets;
|
|
1099
|
-
const sorted = sortByTotalCount( response, inputData.sortOrder );
|
|
1100
|
-
sorted?.map( ( item ) => temp.push( { storeId: item.key.storeId, storeName: item.key.storeName, totalCount: item?.totalCount?.value } ) );
|
|
1101
1119
|
|
|
1102
1120
|
if ( response?.length > 0 ) {
|
|
1121
|
+
const sorted = sortByTotalCount( response, inputData.sortOrder );
|
|
1122
|
+
sorted?.map( ( item ) => temp.push( { storeId: item.key.storeId, storeName: item.key.storeName, totalCount: item?.totalCount?.value } ) );
|
|
1103
1123
|
return res.sendSuccess( { result: temp, count: response?.length } );
|
|
1104
1124
|
} else {
|
|
1105
1125
|
return res.sendError( 'NO Data', 204 );
|
|
@@ -1107,7 +1127,7 @@ export async function getTaggedStores( req, res ) {
|
|
|
1107
1127
|
} catch ( error ) {
|
|
1108
1128
|
const err = error.message || 'Internal Server Error';
|
|
1109
1129
|
logger.error( { error: error, messgage: req.query } );
|
|
1110
|
-
return res.
|
|
1130
|
+
return res.sendError( err, 500 );
|
|
1111
1131
|
}
|
|
1112
1132
|
}
|
|
1113
1133
|
|