|
@@ -4,6 +4,7 @@ import { MessageLog } from "../dependencies/log/type/datatype";
|
|
|
import * as _ from 'lodash'
|
|
|
import { LoggingService } from "../dependencies/log/interface/export";
|
|
|
import { BaseMessage } from "../dependencies/log/dependencies/msgutil/interface/export";
|
|
|
+let processedMsgIds = new Set();
|
|
|
require('dotenv').config();
|
|
|
|
|
|
export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
@@ -97,6 +98,13 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
|
console.log("Record set 2: ", _.keys(_.countBy(data.arr2,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if(process.env.CheckAudit)
|
|
|
+ {
|
|
|
+ console.log("[CheckAudit] Record set 1: ", _.keys(_.countBy(data.arr1,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
+ console.log("[CheckAudit] Record set 2: ", _.keys(_.countBy(data.arr2,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
+ }
|
|
|
+
|
|
|
this.checkArrayDifferences(data).then((data: MessageLog[]) => {
|
|
|
|
|
|
if(process.env.CheckAudit)
|
|
@@ -203,15 +211,13 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
|
// Notification message may have multiple nested data properties that maybe in string format
|
|
|
private checkIfIsInPayloadDataFormat(payload: BaseMessage | any) {
|
|
|
let parsedData: any
|
|
|
- if(payload.data.data){
|
|
|
- if (payload.data.data.data && typeof payload.data.data.data === 'string') {
|
|
|
- parsedData = JSON.parse(payload.data.data.data)
|
|
|
- // console.log(parsedData)
|
|
|
- payload.data.data.data = parsedData
|
|
|
- return payload
|
|
|
- } else {
|
|
|
- return payload
|
|
|
- }
|
|
|
+ if (payload.data
|
|
|
+ && payload.data.data
|
|
|
+ && payload.data.data.data && typeof payload.data.data.data === 'string') {
|
|
|
+ parsedData = JSON.parse(payload.data.data.data)
|
|
|
+ // console.log(parsedData)
|
|
|
+ payload.data.data.data = parsedData
|
|
|
+ return payload
|
|
|
} else {
|
|
|
return payload
|
|
|
}
|