tango-app-api-infra 3.8.6 → 3.8.7

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.8.6",
3
+ "version": "3.8.7",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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' );