tango-app-api-infra 3.9.1 → 3.9.2

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.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,9 +1,14 @@
1
1
  import { chunkArray, download, logger, sendMessageToFIFOQueue, sendMessageToQueue } from 'tango-app-api-middleware';
2
2
  import { bulkUpdate, getOpenSearchById, getOpenSearchCount, getOpenSearchData, insertWithId, updateOpenSearchData } from 'tango-app-api-middleware/src/utils/openSearch.js';
3
3
  import { findOneStore } from '../services/store.service.js';
4
- import dayjs from 'dayjs';
5
4
  import { countDocumnetsCamera } from '../services/camera.service.js';
6
5
  import { findOneRevopDownload, upsertRevopDownload } from '../services/revopDownload.service.js';
6
+ import dayjs from 'dayjs';
7
+ import utc from 'dayjs/plugin/utc.js';
8
+ import timezone from 'dayjs/plugin/timezone.js';
9
+
10
+ dayjs.extend( utc );
11
+ dayjs.extend( timezone );
7
12
 
8
13
  export async function createTicket( req, res ) {
9
14
  try {
@@ -727,7 +732,7 @@ export async function updateStatus( req, res ) {
727
732
  logger.info( { 'Note': `Queue doesn't send` } );
728
733
  }
729
734
  } catch ( error ) {
730
- const err = error.messgae || 'Internal Server Error';
735
+ const err = error.message || 'Internal Server Error';
731
736
  logger.error( { error: error, data: req.body, function: 'infra-footfallDirectory-updateStatus' } );
732
737
  return res.sendError( err, 500 );
733
738
  }
@@ -755,6 +760,7 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
755
760
  data.approverUserName = user?.userName || '';
756
761
  data.approverEmail = user?.email || '';
757
762
  data.approverRole = user?.role || '';
763
+ data.updatedAt = new Date();
758
764
  }
759
765
  let tempId = [];
760
766
  const { _id, ...updateData } = data;
@@ -1011,12 +1017,12 @@ export async function sendSqsMessage( inputData, tempId, getStoreType, storeId )
1011
1017
  } );
1012
1018
  return false;
1013
1019
  } else {
1014
- const id =`${storeId}_${inputData.dateString.split( '-' ).reverse().join( '-' )}_${getStoreType > 0? "live":"reduction"}_${Date.now()}`
1020
+ const id =`${storeId}_${inputData.dateString.split( '-' ).reverse().join( '-' )}_${getStoreType > 0? 'live':'reduction'}_${Date.now()}`;
1015
1021
  const logs = {
1016
- QueueUrl: sqsProduceQueue.QueueUrl,
1017
- MessageBody: sqsProduceQueue.MessageBody,
1018
- sqsQueue:sqsQueue,
1019
- store_id: storeId,
1022
+ QueueUrl: sqsProduceQueue.QueueUrl,
1023
+ MessageBody: sqsProduceQueue.MessageBody,
1024
+ sqsQueue: sqsQueue,
1025
+ store_id: storeId,
1020
1026
  store_date: inputData.dateString.split( '-' ).reverse().join( '-' ),
1021
1027
  bucket_name: '',
1022
1028
  zone_id: 'traffic_zone',
@@ -1024,9 +1030,10 @@ export async function sendSqsMessage( inputData, tempId, getStoreType, storeId )
1024
1030
  revop_type: 'footfall',
1025
1031
  temp_id: tempId,
1026
1032
  time: Date.now(),
1027
- createdAt:new Date()
1028
- }
1029
- await insertWithId(openSearch.revopsLog,id,logs)
1033
+ createdAt: new Date(),
1034
+ createIST: dayjs().tz( 'Asia/Kolkata' ).format( 'YYYY-MM-DD' ),
1035
+ };
1036
+ await insertWithId( openSearch.revopsLog, id, logs );
1030
1037
  return true;
1031
1038
  }
1032
1039
  }
@@ -1497,4 +1504,3 @@ async function extractTempIds( document ) {
1497
1504
  return result;
1498
1505
  }
1499
1506
 
1500
-
@@ -208,7 +208,7 @@ export const footfallDirectoryDocs = {
208
208
  },
209
209
 
210
210
  '/v3/footfall-directory-tagging/update-status': {
211
- get: {
211
+ put: {
212
212
  tags: [ 'Footfall Directory Ticket' ],
213
213
  description: 'approve or reject the ticket status',
214
214
  operationId: 'update-status',