tango-app-api-infra 3.1.34-beta.7 → 3.1.34-beta.9

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.1.34-beta.7",
3
+ "version": "3.1.34-beta.9",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -91,7 +91,7 @@ export async function basicList( req, res ) {
91
91
  for ( let client of clientList ) {
92
92
  clients.push( client.clientId );
93
93
  }
94
- let storeList = await findStore( { 'clientId': { $in: clients }, 'status': 'active', 'edge.firstFile': true },
94
+ let storeList = await findStore( { 'clientId': { $in: clients }, 'status': 'active', 'edge.firstFile': true, 'storeProfile.open': { $exists: true }, 'storeProfile.close': { $exists: true }, 'storeProfile.timeZone': { $exists: true } },
95
95
  { 'storeName': 1, 'storeId': 1, 'ticketConfigs': 1, 'clientId': 1, 'storeProfile.open': 1, 'storeProfile.close': 1, 'storeProfile.timeZone': 1 } );
96
96
  logger.info( { 'storeList': storeList, 'message': 'storeList' } );
97
97
 
@@ -799,7 +799,7 @@ export async function edgeApplogsCheck( req, res ) {
799
799
  }
800
800
  for ( let error of errorLogList.body.hits.hits ) {
801
801
  const logCode = error._source.log_code;
802
- const relevantCodes = [ 1003, 1011, 1022, 1024, 1025, 1000 ];
802
+ const relevantCodes = [ 1003, 1011, 1022, 1024, 1025, 1026, 1000 ];
803
803
  if ( relevantCodes.includes( Number( logCode ) ) ) {
804
804
  result.push( createLogCheck( error ) );
805
805
  }
@@ -826,7 +826,10 @@ export async function edgeApplogsCheck( req, res ) {
826
826
  const occurringTimeParsed = dayjs( `${req.body.date} ${findissue.edgelog.occuringTime}` );
827
827
  const ticketCreatedParsed = dayjs( `${req.body.date} ${istTimestamp}` );
828
828
  const isOccurringTimeEarlier = occurringTimeParsed.isBefore( ticketCreatedParsed );
829
- if ( isOccurringTimeEarlier ) {
829
+ const existsInArray = finalresult.some( ( item ) =>
830
+ item.ticketId === ticket.ticketId,
831
+ );
832
+ if ( isOccurringTimeEarlier&&!existsInArray ) {
830
833
  findissueEdgeApp = {
831
834
  ticketId: ticket.ticketId,
832
835
  edgelog: findissue,
@@ -844,7 +847,10 @@ export async function edgeApplogsCheck( req, res ) {
844
847
  const stroreopenTime = dayjs( `${req.body.date} ${store.storeProfile.open}` );
845
848
  const isOccurringTimeEarlier = occurringTimeParsed.isBefore( ticketCreatedParsed );
846
849
  const afterStoreOpen = occurringTimeParsed.isAfter( stroreopenTime );
847
- if ( isOccurringTimeEarlier&&afterStoreOpen ) {
850
+ const existsInArray = finalresult.some( ( item ) =>
851
+ item.ticketId === ticket.ticketId,
852
+ );
853
+ if ( isOccurringTimeEarlier&&afterStoreOpen&&!existsInArray ) {
848
854
  logincount.push( findissue.edgelog.occuringTime );
849
855
  if ( logincount.length >3 ) {
850
856
  findissueEdgeApp = {
@@ -952,22 +958,27 @@ export async function edgeApplogsCheck( req, res ) {
952
958
  updateIssue( findissueEdgeApp );
953
959
  finalresult.push( findissueEdgeApp );
954
960
  }
955
- } else if ( findissue.code == '1000' ) {
961
+ } else if ( findissue.code == '1026' ) {
956
962
  const occurringTimeParsed = dayjs( `${req.body.date} ${findissue.edgelog.occuringTime}` );
957
963
  const ticketCreatedParsed = dayjs( `${req.body.date} ${istTimestamp}` );
958
964
  const isOccurringTimeEarlier = occurringTimeParsed.isBefore( ticketCreatedParsed );
959
- if ( isOccurringTimeEarlier ) {
960
- findissueEdgeApp = {
961
- ticketId: ticket.ticketId,
962
- edgelog: findissue,
963
- storeId: ticket.basicDetails.storeId,
964
- primary: 'Application Issues',
965
- secondary: [ 'Application crashed' ],
966
- };
965
+ const existsInArray = finalresult.some( ( item ) =>
966
+ item.ticketId === ticket.ticketId,
967
+ );
968
+ if ( isOccurringTimeEarlier &&!existsInArray ) {
969
+ if ( ( Number( findissue.edgelog.files_generated )-Number( findissue.edgelog.files_pushed ) )>1 ) {
970
+ findissueEdgeApp = {
971
+ ticketId: ticket.ticketId,
972
+ edgelog: findissue,
973
+ storeId: ticket.basicDetails.storeId,
974
+ primary: 'Internet Issues',
975
+ secondary: [ 'Internet slow' ],
976
+ };
977
+ }
967
978
  updateIssue( findissueEdgeApp );
968
979
  finalresult.push( findissueEdgeApp );
969
980
  }
970
- } else if ( findissue.code === '1016' ) {
981
+ } else if ( findissue.code == '1016' ) {
971
982
  const occurringTimeParsed = dayjs( `${req.body.date} ${findissue.edgelog.occuringTime}` );
972
983
  const ticketCreatedParsed = dayjs( `${req.body.date} ${istTimestamp}` );
973
984
  const isOccurringTimeEarlier = occurringTimeParsed.isBefore( ticketCreatedParsed );
@@ -985,20 +996,20 @@ export async function edgeApplogsCheck( req, res ) {
985
996
  updateIssue( findissueEdgeApp );
986
997
  finalresult.push( findissueEdgeApp );
987
998
  }
988
- } else if ( findissue.code === '1005' ) {
999
+ } else if ( findissue.code == '1000' ) {
989
1000
  const occurringTimeParsed = dayjs( `${req.body.date} ${findissue.edgelog.occuringTime}` );
990
1001
  const ticketCreatedParsed = dayjs( `${req.body.date} ${istTimestamp}` );
991
1002
  const isOccurringTimeEarlier = occurringTimeParsed.isBefore( ticketCreatedParsed );
992
1003
  const existsInArray = finalresult.some( ( item ) =>
993
1004
  item.ticketId === ticket.ticketId,
994
1005
  );
995
- if ( isOccurringTimeEarlier &&!existsInArray ) {
1006
+ if ( isOccurringTimeEarlier&&!existsInArray ) {
996
1007
  findissueEdgeApp = {
997
1008
  ticketId: ticket.ticketId,
998
1009
  edgelog: findissue,
999
1010
  storeId: ticket.basicDetails.storeId,
1000
- primary: 'Internet Issues',
1001
- secondary: [ 'Internet slow' ],
1011
+ primary: 'Application Issues',
1012
+ secondary: [ 'Application crashed' ],
1002
1013
  };
1003
1014
  updateIssue( findissueEdgeApp );
1004
1015
  finalresult.push( findissueEdgeApp );